The translate() function moves the origin of the coordinate system to the specified location.
The push() and pop() functions save and restore the coordinate system and various other drawing settings, such as the fill color.
Note that in this example, we draw the shapes (rectangle and circle) each time in a different coordinate system.
Translate by p5.js Contributors and the Processing Foundation is licensed under CC BY-NC-SA 4.0.