Skip to main content

Rotate

The Rotate action changes the node's zRotation over time.

The options object for the Rotate action has the following properties:

  • byAngle: Relative amount to rotate the node, in counter-clockwise radians.
  • toAngle: Absolute angle to which rotate the node, in counter-clockwise radians.
  • shortestUnitArc: If toAngle is provided, should the rotation be performed in the direction that leads to the smallest rotation? Default is true.
  • duration: The duration of the animation in milliseconds.
  • runDuringTransition: A boolean indicating whether the action should run during a transition. This is an optional property. If not specified, the default is false.

In the below example, clicking "L" will rotate the "Rotate Me" rectangle by a small amount (π/16 radians) to the left. Clicking "R" rotates it to the right. Clicking "Reset" will rotate it back to its original position.

Loading...