web api instance method
DOMMatrixReadOnly: multiply() method
Available in workers
The multiply() method of the DOMMatrixReadOnly interface creates and returns a new matrix which is the dot product of the matrix and the otherMatrix parameter. If otherMatrix is omitted, 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. The original matrix is not modified.
To mutate the matrix as you multiply it, see multiplySelf().
Syntax
multiply()
multiply(otherMatrix)
Parameters
otherMatrixOptional- : The
DOMMatrixmultiplier.
- : The
Return value
A DOMMatrix.
Examples
const matrix = new DOMMatrixReadOnly().translate(13, 21);
const multipliedMatrix = matrix.multiply(matrix);
console.log(matrix.toString()); // output: matrix(1, 0, 0, 1, 13, 21)
console.log(multipliedMatrix.toString()); // output: matrix(1, 0, 0, 1, 26, 42)
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
multiplySelf()preMultiplySelf()- CSS
matrix()function - CSS
matrix3d()function