DOMMatrixReadOnly: isIdentity プロパティ
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年1月.
メモ: この機能はウェブワーカー内で利用可能です。
isIdentity は DOMMatrixReadOnly インターフェイスの読み取り専用プロパティで、この行列が恒等行列であれば true となる論理値です。
恒等行列とは、左上から右下への主対角線上の要素(言い換えれば、各方向のオフセットが等しい位置)の値を除き、すべての値が 0 である行列です。
値
論理値です。
例
js
// 二次元の行列を初期化
const matrix = new DOMMatrix(); // 行列を作成
console.log(matrix.isIdentity); // 出力: true
// 影響がない座標変換を適用
console.log(matrix.translate(0).isIdentity); // 出力: true
// 影響のある座標変換を適用: 行列を 30 度回転
console.log(matrix.rotate(30).isIdentity); // 出力: false
仕様書
| Specification |
|---|
| Geometry Interfaces Module Level 1> # dom-dommatrixreadonly-isidentity> |
ブラウザーの互換性
関連情報
DOMMatrixinterfaceCSSMatrixComponentinterfaceCanvasRenderingContext2Dインターフェイス- CSS の
matrix()関数 - CSS の
transformプロパティ - CSS 座標変換モジュール
- SVG の
transform属性