DOMMatrixReadOnly: inverse()-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.
Hinweis: Diese Funktion ist in Web Workers verfügbar.
Die inverse()
-Methode der DOMMatrixReadOnly
-Schnittstelle erstellt eine neue Matrix, die das Inverse der ursprünglichen Matrix ist. Wenn die Matrix nicht invertiert werden kann, werden alle Komponenten der neuen Matrix auf NaN
gesetzt und ihre is2D
-Eigenschaft wird auf false
gesetzt. Die ursprüngliche Matrix wird nicht verändert.
Um die Matrix bei der Invertierung zu modifizieren, siehe DOMMatrix.invertSelf()
.
Syntax
js
inverse()
Parameter
Keine.
Rückgabewert
Eine DOMMatrix
.
Beispiele
js
const matrix = new DOMMatrixReadOnly().rotate(30);
const invertedMatrix = matrix.inverse();
console.log(matrix.toString());
// output: matrix(0.866, 0.5, -0.5, 0.866, 0, 0)
console.log(invertedMatrix.toString());
// output: matrix(0.866, -0.5, 0.5, 0.866, 0, 0)
Spezifikationen
Specification |
---|
Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-inverse |
Browser-Kompatibilität
Siehe auch
DOMMatrix.invertSelf()
DOMMatrixReadOnly.flipX()
DOMMatrixReadOnly.flipY()
- CSS
matrix()
-Funktion - CSS
matrix3d()
-Funktion