CSSRotate: CSSRotate() constructor

Note: This feature is available in Web Workers.

The CSSRotate() constructor creates a new CSSRotate object representing the rotate() value of the individual transform property in CSS.

This can be specified as either a 2D rotation by a particular angle, or as a 3D rotation by an angle around a particular axis.

Syntax

js
new CSSRotate(angle)
new CSSRotate(x, y, z, angle)

Parameters

angle

A value for the angle of the CSSRotate object to be constructed. This must be a CSSNumericValue.

x Optional

A value for the x-axis of the CSSRotate object to be constructed. This must either be a number (which is wrapped into a CSSUnitValue of unit: "number") or a CSSNumericValue. Only used, and required, when constructing a 3D rotation.

y Optional

A value for the y-axis of the CSSRotate object to be constructed. This must either be a number (which is wrapped into a CSSUnitValue of unit: "number") or a CSSNumericValue. Only used, and required, when constructing a 3D rotation.

z Optional

A value for the z-axis of the CSSRotate object to be constructed. This must either be a number (which is wrapped into a CSSUnitValue of unit: "number") or a CSSNumericValue. Only used, and required, when constructing a 3D rotation.

Exceptions

TypeError

Raised if the value of CSSRotate.angle is not an <angle> value or CSSRotate.x, CSSRotate.y, CSSRotate.z are not <number> values.

Examples

To do

Specifications