Epicycle Studio

Pick a shape, draw a scribble or type a word. The page works out which spinning circles, stacked end to end, trace that exact outline, then sets them turning. Slide the circle count down to watch the drawing lose detail, or zoom in on the pen to see the tiny circles doing the fine work.

Source

Try Circle first: it needs exactly one. A square's sharp corners need far more.

0
10
off

Zoom in to follow the pen tip and see the tiny circles. Slow the lap down when you zoom far in.

The circles, biggest first
#SpinsRadiusAngle

What the circles are doing

  1. Walk the outline once. The shape becomes a list of a few hundred points, in order, like a pen moving around it over one lap of time.
  2. Ask which circles fit. Picture circles that each spin a whole number of times per lap: once, twice, three times, or backwards. The Fourier transform finds how big each one must be, and where it starts, so that stacking them tip to tail lands the pen on every point.
  3. Big circles draw the gist, small ones add detail. The slow, large circles give the overall blob. Faster, tiny ones carve corners and serifs. Drag the Circles slider to 3 and then to the max to see this.
pen(t) = Σ radius · (cos, sin)(2π · spins · t + angle)

Here t runs from 0 to 1 over one lap, angles are counterclockwise from the right, and y points up, like a standard graph. Each row in the table is one term of that sum, and those three numbers per row are enough to redraw the picture from nothing.

How it's built

  • No libraries. Plain JavaScript and the Canvas 2D API in a single HTML file.
  • A hand-written discrete Fourier transform. The outline is resampled to evenly spaced points, centered on its average, and transformed as complex numbers (x + iy). Each output term becomes one circle.
  • Text tracing. Letters are rendered off-screen, their edge pixels are found, and a nearest-neighbour walk joins them into a single pen path.
  • A zooming camera. The view can lock onto the pen tip at up to ×200, with line widths and grid spacing adjusted so the smallest circles stay crisp.