DOMMatrix: invertSelf() 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 invertSelf()
Methode des DOMMatrix
Interfaces invertiert die ursprüngliche Matrix. Wenn die Matrix nicht invertiert werden kann, werden die neuen Komponenten der Matrix alle auf NaN
gesetzt und ihre is2D
Eigenschaft wird auf false
gesetzt.
Um eine Matrix zu invertieren, ohne sie zu verändern, siehe DOMMatrixReadOnly.inverse()
Syntax
js
invertSelf()
Parameter
Keine.
Rückgabewert
Eine DOMMatrix
.
Beispiele
In diesem Beispiel erstellen wir eine Matrix mit einer Rotation von 30 Grad. Dann invertieren wir sie, was zu einer Rotation von -30 Grad führt.
js
const matrix = new DOMMatrix().rotate(30);
console.log(matrix.toString());
// output: matrix(0.866, 0.5, -0.5, 0.866, 0, 0)
matrix.invertSelf();
console.log(matrix.toString());
// output: matrix(0.866, -0.5, 0.5, 0.866, 0, 0)
Spezifikationen
Specification |
---|
Geometry Interfaces Module Level 1> # dom-dommatrix-invertself> |
Browser-Kompatibilität
Loading…
Siehe auch
DOMMatrixReadOnly.inverse()
- CSS
matrix()
Funktion - CSS
matrix3d()
Funktion