DOMMatrixReadOnly: is2D プロパティ
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月.
メモ: この機能はウェブワーカー内で利用可能です。
is2D は DOMMatrixReadOnly インターフェイスの読み取り専用プロパティで、行列が二次元である場合に true となる論理値のフラグです。行列が二次元行列として初期化され、二次元変換操作のみが適用された場合、この値は true となります。それ以外の場合は、行列は三次元で定義され、is2D は false となります。
値
論理値です。
例
js
// 二次元の行列を初期化
const matrix = new DOMMatrix(); // 行列を作成
console.log(matrix.is2D); // 出力: true
// 二次元空間で座標変換
console.log(matrix.rotate(30).is2D); // 出力: true
// 三次元座標変換を適用
console.log(matrix.rotate(10, 20, 1).is2D); // 出力: false
仕様書
| Specification |
|---|
| Geometry Interfaces Module Level 1> # dom-dommatrixreadonly-is2d> |
ブラウザーの互換性
関連情報
CSSTransformValue.is2DCSSTransformComponent.is2D- CSS の
<transform-function>関数 - CSS の
transformプロパティ - CSS 座標変換モジュール
- SVG の
transform属性 CanvasRenderingContext2Dインターフェイス