DOMMatrix: multiplySelf() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

Note: This feature is available in Web Workers.

The multiplySelf() method of the DOMMatrix interface multiplies a matrix by the otherMatrix parameter, computing the dot product of the original matrix and the specified matrix: A⋅B. If no matrix is specified as the multiplier, the matrix is multiplied by a matrix in which every element is 0 except the bottom-right corner and the element immediately above and to its left: m33 and m34. These have the default value of 1.

To multiply a matrix without mutating it, see DOMMatrixReadOnly.multiply().

Syntax

js
multiplySelf()
multiplySelf(otherMatrix)

Parameters

Return value

Returns itself; the DOMMatrix updated to the results of the applied multiplications.

Examples

js
const matrix = new DOMMatrix().rotate(30);

console.log(matrix.toString());
// output: matrix(0.866, 0.5, -0.5, 0.866, 0, 0)

matrix.multiplySelf(matrix);

console.log(matrix.toString());
// output: matrix(0.5, 0.866, -0.866, 0.5, 0, 0) (a 60deg rotation)

Specifications

Specification
Geometry Interfaces Module Level 1
# dom-dommatrix-multiplyself

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
multiplySelf

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also