DOMMatrixReadOnly: is2D 属性
注意:此功能在 Web Workers 中可用。
DOMMatrixReadOnly
接口的只读属性 is2D
是一个布尔标志,当矩阵为 2D 时为 true
。如果矩阵被初始化为 2D 矩阵并且只应用了 2D 转换操作,则该值为 true
。否则,矩阵在 3D 中定义,is2D
为 false
。
值
一个布尔值。
示例
js
// Initialize a 2D matrix
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.is2D); // output: true
// Transform in a 2D space
console.log(matrix.rotate(30).is2D); // output: true
// Apply a 3D transform
console.log(matrix.rotate(10, 20, 1).is2D); // output: false
规范
规范 |
---|
Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-is2d |
浏览器兼容性
加载中…
另见
CSSTransformValue.is2D
CSSTransformComponent.is2D
- CSS
<transform-function>
函数 - CSS
transform
属性 - CSS 变换模块
- SVG
transform
属性 CanvasRenderingContext2D
接口