Examples Rotate

Rotate

The rotate() function rotates the current coordinate system around the current origin.

Note that by default the origin is the upper left corner of the canvas. In order to rotate around the center of the canvas, we must first translate the coordinate system, and then rotate around the new origin.

The push() and pop() functions save and restore the coordinate system, respectively.

Rotate: Revised by Darren Kessner. Edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.

You can find the code history of these examples here: 2023 code, pre-2023 code. You can suggest improvements by contributing to the current website!