DOMMatrix: preMultiplySelf() Methode

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.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Hinweis: Diese Funktion ist in Web Workers verfügbar.

Die preMultiplySelf() Methode der DOMMatrix Schnittstelle modifiziert die Matrix, indem sie mit der angegebenen DOMMatrix vor-multipliziert wird. Dies entspricht dem Punktprodukt B⋅A, wobei Matrix A die Ursprungsmatrix und B die als Eingabe für die Methode angegebene Matrix ist. Wenn keine Matrix als Multiplikator angegeben ist, wird die Matrix mit einer Matrix multipliziert, bei der jedes Element 0 ist, außer die untere rechte Ecke und das direkt darüber und links davon liegende Element: m33 und m34. Diese haben den Standardwert 1.

Syntax

js
preMultiplySelf()
preMultiplySelf(otherMatrix)

Parameter

otherMatrix Optional

Der DOMMatrix Multiplikator.

Rückgabewert

Gibt sich selbst zurück; eine DOMMatrix, die mit den Ergebnissen der angewandten Multiplikationen aktualisiert wurde.

Beispiele

js
const matrix = new DOMMatrix().translate(3, 22);
const otherMatrix = new DOMMatrix().translateSelf(15, 45);

console.log(matrix.toString()); // output: matrix(1, 0, 0, 1, 3, 22)
console.log(otherMatrix.toString()); // output: matrix(1, 0, 0, 1, 15, 45)

matrix.preMultiplySelf(otherMatrix);

console.log(matrix.toString()); // output: matrix(1, 0, 0, 1, 18, 67)
console.log(otherMatrix.toString()); // output: matrix(1, 0, 0, 1, 15, 45)

Spezifikationen

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

Browser-Kompatibilität

Siehe auch