Skip to main content

Rotation

Adjust a node's zRotation to rotate it about its axis.

A node's zRotation property determines its rotation. The unit of measurement is radians instead of degrees. There are 2π radians in a circle, or 360°. A positive rotation is counterclockwise, and a negative rotation is clockwise. The rotation affects any children, if present. For example, if you rotate a Scene, all of its children will also be rotated.

tip

In JavaScript, if you don't want to type 3.14159... for π, you can use Math.PI.

Below, the letter A has its zRotation is set to π/2, which is ¼ of a full circle or 90°. The letter A is rotated counterclockwise.

Loading...
Explore:
  • See how nodes inherit their parents' rotations. The top letter A has been added as a child of the square, which has been rotated π/4 radians, or 45° counterclockwise. The letter A inherits this rotation. The bottom letter A has been added as child of another square, which also has been rotated π/4 radians. The bottom A in inherits this rotation, but this bottom A has its own rotation -Math.PI / 4 which is also applied and "cancels out" its parent rotation.