CSSTransformValue: is2D property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
Note: This feature is available in Web Workers.
The is2D read-only property of the CSSTransformValue interface returns whether the transform is 2D or 3D.
is2D is true only if every CSSTransformComponent in the CSSTransformValue is itself 2D (see CSSTransformComponent.is2D), otherwise it is false.
Value
A boolean. true if every object in the value is 2D, otherwise false.
Examples
>Comparing 2D and 3D transforms
js
const transform2D = new CSSTransformValue([
new CSSTranslate(CSS.px(10), CSS.px(20)),
new CSSScale(2, 3),
]);
console.log(transform2D.is2D); // true
const transform3D = new CSSTransformValue([
new CSSTranslate(CSS.px(10), CSS.px(20), CSS.px(30)),
new CSSScale(2, 3),
]);
console.log(transform3D.is2D); // false
Specifications
| Specification |
|---|
| CSS Typed OM Level 1> # dom-csstransformvalue-is2d> |