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 January 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 Komponenten der neuen 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
invertSelf()
Rückgabewert
Eine DOMMatrix
.
Beispiele
In diesem Beispiel erstellen wir eine Matrix mit einer Drehung von 30 Grad. Dann invertieren wir sie, was zu einer Drehung von -30 Grad führt.
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
BCD tables only load in the browser
Siehe auch
DOMMatrixReadOnly.inverse()
- CSS
matrix()
Funktion - CSS
matrix3d()
Funktion