DOMMatrixReadOnly:isIdentity 屬性
注意:此功能在 Web Workers 中可用。
DOMMatrixReadOnly 介面的只讀 isIdentity 屬性是一個布林值,如果矩陣是單位矩陣,則該屬性值為 true。
單位矩陣是一種矩陣,其中所有值都為 0,除了從左上角到右下角的主對角線上的值(換句話說,每個方向上的偏移量都相等)。
值
一個布林值。
示例
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
規範
| 規範 |
|---|
| Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-isidentity |
瀏覽器相容性
載入中…
另見
DOMMatrix介面CSSMatrixComponent介面CanvasRenderingContext2D介面- CSS
matrix()函式 - CSS
transform屬性 - CSS 變換模組
- SVG
transform屬性