rotate()
Rotates the entire coordinate system around the origin
Example

translate(width/2, height/2)
rotate(frameCount * 0.5)
trect(50, 50, 100, 100)
Syntax
rotate(angle)
Input
Description
angle
the angle of rotation in radians/degrees depending on angle mode
What is actually happening in the above example is 👇

Description
The rotate()
function is used to rotate the coordinate system by a specified angle about the current origin. This means that any subsequent drawing or transformation function will be affected by this rotation.
Positive angles will rotate the plane from +x to +y, so:
In
BOTTOM_RIGHT
coordinate system, positive angles rotate counter-clockwise.In
BOTTOM_LEFT
coordinate system, positive angles rotate clockwise.
Negative angles rotate the plane from +x to -y
Last updated