🎡

Spirograph

36 rotating squares, one every 10°, in a rainbow — a classic spirograph.

Builder· ages 10–1220 minnested for loopslist indexing with moduloangle math
spirograph.py

First load pulls ~10 MB of Python. Only happens once — the browser caches it after.

What should the output look like?

A rainbow flower-like pattern made of overlapping squares.

📖

How this works

Draw the same square 36 times, rotating a small 10° between each. Because 36 × 10° = 360°, the whole pattern sweeps through a full circle. The overlapping squares create a delicate flower-of-lines look — the classic spirograph.

Your turn — try these

  • 1Change `range(36)` to `range(72)` and the rotation from `10` to `5`.
  • 2Replace the square (4 sides × 90°) with a triangle (3 sides × 120°).
  • 3Instead of squares, try pentagons: 5 sides, 72° per turn.