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.