DOMMatrixReadOnly: isIdentity-Eigenschaft
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 unveränderliche isIdentity
-Eigenschaft des DOMMatrixReadOnly
-Interfaces ist ein Boolean, dessen Wert true
ist, wenn die Matrix die Einheitsmatrix ist.
Die Einheitsmatrix ist eine Matrix, in der jeder Wert 0
ist, außer denen auf der Hauptdiagonale von der oberen linken zur unteren rechten Ecke (mit anderen Worten, wo die Versätze in jeder Richtung gleich sind).
Wert
Ein Boolean-Wert.
Beispiele
js
// Initialize a 2D matrix
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.isIdentity); // output: true
// Apply a transform that has no effect
console.log(matrix.translate(0).isIdentity); // output: true
// Apply a transform with effect: this rotates the matrix by 30deg
console.log(matrix.rotate(30).isIdentity); // output: false
Spezifikationen
Specification |
---|
Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-isidentity |
Browser-Kompatibilität
BCD tables only load in the browser
Siehe auch
DOMMatrix
-InterfaceCSSMatrixComponent
-InterfaceCanvasRenderingContext2D
-Interface- CSS
matrix()
-Funktion - CSS
transform
-Eigenschaft - CSS-Transformationen-Modul
- SVG
transform
-Attribut