DOMMatrixReadOnly: is2D property
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.
Note: This feature is available in Web Workers.
The readonly is2D
property of the DOMMatrixReadOnly
interface is a Boolean flag that is true
when the matrix is 2D. The value is true
if the matrix was initialized as a 2D matrix and only 2D transformation operations were applied. Otherwise, the matrix is defined in 3D, and is2D
is false
.
Value
A Boolean value.
Examples
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
Specifications
Specification |
---|
Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-is2d |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
is2D |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
See also
CSSTransformValue.is2D
CSSTransformComponent.is2D
- CSS
<transform-function>
functions - CSS
transform
property - CSS transforms module
- SVG
transform
attribute CanvasRenderingContext2D
interface