Spirograph illustration

Spirograph

A spirograph traces the path of a point on a small gear as it rolls around a big one. Roll it inside and you get hypotrochoids; roll it outside and you get epitrochoids — the looping, petalled, star-like curves from the classic toy. The shape depends on the ratio of the two radii and how far the pen sits from the rolling gear’s centre: a rational ratio closes into a neat figure, while a nearly irrational one nearly never closes and fills a dense band. Drag the ring size, wheel size and pen offset and watch the curve draw live in colour, or randomise for a fresh pattern, then export it as a PNG.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • The pen position is a sum of two rotations, one for the gear rolling around the ring and one for the pen around the gear, giving the parametric hypotrochoid and epitrochoid equations.
  • The pattern closes after the rolling gear completes a whole number of trips, set by the ratio of the radii in lowest terms: 5/3 closes quickly, 97/89 takes far longer and looks almost solid.
  • Moving the pen offset from the gear’s centre out past its rim turns gentle rounded curves into sharp cusped loops — the same knob as the hole you picked on the plastic wheel.
  • Runs 100% in your browser — simulations are computed locally on your device.