DOMMatrixReadOnly: multiply() Methode
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since Januar 2020.
Hinweis: Diese Funktion ist in Web Workers verfügbar.
Die multiply()-Methode des DOMMatrixReadOnly-Interfaces erstellt und gibt eine neue Matrix zurück, die das Punktprodukt der Matrix und des otherMatrix-Parameters ist. Wenn otherMatrix weggelassen wird, wird die Matrix mit einer Matrix multipliziert, bei der jedes Element 0 ist, außer der unteren rechten Ecke und dem Element direkt darüber und links davon: m33 und m34. Diese haben den Standardwert 1. Die ursprüngliche Matrix wird nicht verändert.
Um die Matrix zu mutieren, während Sie sie multiplizieren, siehe DOMMatrix.multiplySelf().
Syntax
multiply()
multiply(otherMatrix)
Parameter
otherMatrixOptional-
Der
DOMMatrix-Multiplikator.
Rückgabewert
Eine DOMMatrix.
Beispiele
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)
Spezifikationen
| Specification |
|---|
| Geometry Interfaces Module Level 1> # dom-dommatrixreadonly-multiply> |
Browser-Kompatibilität
Loading…
Siehe auch
DOMMatrix.multiplySelf()DOMMatrix.preMultiplySelf()- CSS
matrix()Funktion - CSS
matrix3d()Funktion