Spirograph
Hypotrochoid and epitrochoid curves, the roulettes a Spirograph toy draws, layered into rosettes and tiled across the canvas.

A spirograph rolls a toothed circle inside (or outside) another, with a pen through a hole in the small circle drawing a flower-like curve. Rolling inside draws a hypotrochoid; rolling outside draws an epitrochoid.
How the maths works
- Hypotrochoid (small circle rolls inside)
- x = (R − r) cos t + d · cos((R − r) / r · t)y = (R − r) sin t − d · sin((R − r) / r · t)
- Epitrochoid (small circle rolls outside)
- x = (R + r) cos t − d · cos((R + r) / r · t)y = (R + r) sin t − d · sin((R + r) / r · t)
- The range needed for the curve to close
- 0 ≤ t ≤ 2π · r / gcd(R, r)
While the small circle’s centre travels around the big circle, the small circle also spins. The pen’s position is the sum of these two circular motions, which written out are the hypotrochoid and epitrochoid equations.
R and r are tooth counts, so they are whole numbers and the curve always returns to its start: the small circle’s centre goes around r / gcd(R, r) times before the curve closes, drawing R / gcd(R, r) petals. R = 7 and r = 2 give 7 petals.
The pen distance d shapes the petals: below r they are rounded waves, equal to r they come to sharp points, and above r each petal makes a small loop.
Parameters
- Curve
- Roll the small circle inside the big one (hypotrochoid) or outside it (epitrochoid).
- Hypotrochoid (inside) · Epitrochoid (outside)
- Outer teeth
- Tooth count R of the big circle. Together with the small circle it sets the number of petals.
- 3 to 13
- Inner teeth
- Tooth count r of the small circle. When R and r share a factor, the curve closes sooner and has fewer petals.
- 1 to 6
- Pen distance
- Distance of the pen hole from the small circle’s centre, with the small radius as 1. At 1 the petals come to points; above 1 they loop.
- 0.3 to 1.8
- Layers
- How many curves with different pen distances to stack into a layered flower.
- 1 to 5
- Flowers per short edge
- How many flowers across the short side.
- 1 to 6
- Line width
- Line width, relative to the short side of the canvas.
- 0.001 to 0.012
- Blur
- Overall blur, relative to the canvas short side. 0 means no blur; larger values soften the lines into a glow.
- 0 to 0.04
Examples
Each example opens in the studio with these settings.
Using it as a background
Thin lines on a dark background look most like a real spirograph; 3 to 5 layers shaded along the palette give depth.
Try tooth counts with no common factor, such as 7 and 3 or 11 and 4: they give the most, finest petals.