How circles draw any shape
Fourier series explainer: epicycles draw a wave first, then a hand
- 0–3.4 s One circle turns, its height unrolls over time into a sine wave
- 3.4–8.4 s Three, then seven circles chained tip to tail, the wave turns almost square, the Gibbs overshoot is marked
- 8.4–11.2 s The time axis folds into the tip, the wave becomes a closed curve, the circles retune
- 11.2–17 s The count rises from 7 to 64, each circle sharpens the outline until it is a hand
- 17–20 s The finished hand holds briefly, then the circles dissolve and the first circle is back at the start
- Explainer
- 20 s Loop
- 1080² · 30 fps
- Canvas 2D
- 1 MB
Prompt
Build a 20-second looping explainer, 1080×1080: "how circles draw any shape". Epicycles (circles riding on circles) first unroll into a wave, then draw a closed outline. Nothing is faked: every radius and phase comes from a real decomposition. All on-screen text comes from one small dictionary; ?lang=de switches to German.
DESIGN
A calm, precise teaching film on a dark blueprint ground #101A2A with a faint 54 px grid. Chalk white #E8EDF4 for lines and text, muted blue-grey #8FA0B8 for labels, one accent, chalk yellow #F4C152, used only for the tip, the newest circle, its spectrum bar and the Gibbs marking. Instrument Serif for the caption (47 px, two lines, top left) and the maths, Geist for small tracked uppercase labels, Geist Mono for every number. Top right: "n = 64" as one left-aligned block. Bottom, under a hairline: left a spectrum of 64 slots (bar height = amplitude on a log scale, pending slots as dots, the newest term in the accent, a readout "k = −12" for its frequency), right the formula f(t) = Σ aₙ · e^(i n t), the sigma drawn as a filled glyph with thick and thin strokes, variables slanted.
STORYBOARD
0–3.4 s One circle on the left, radius vector turning once per 2.4 s. A dashed connector carries the height of its tip to a graph axis, where it unrolls over time into a sine wave. Caption: "One circle. Its height, unrolled over time, is a sine wave."
3.4–8.4 s Two more circles join tip to tail (frequencies 3 and 5, radii 4/(πk)), then four more up to k = 13. The trace turns into a square wave; the true square wave runs along dashed. With seven circles two thin accent lines mark the level the partial sum really reaches, labelled "Gibbs overshoot +9 % of the jump".
8.4–11.2 s The transition is the idea: the time axis folds into the tip. Each trace point moves from "height over time" to "where the tip was", so the wave collapses into the closed curve the same seven circles draw in the plane, while the chain glides to the centre and the graph leaves with it. Then the seven circles retune from the wave's coefficients to the first seven of a hand outline.
11.2–17 s n counts 7 … 64. Every new circle (frequencies +1, −1, +2, −2, … ±32) grows in at the end of the chain, its bar rises in the spectrum, and the closed curve sharpens from a blob into a hand with five fingers. The true outline sits behind as a faint dotted ghost.
17–20 s Hold on "64 circles draw a hand." Then the circles dissolve from the outside in, n runs back to 1, the remaining circle returns to the left, the graph axis comes back and the connector grows out of the tip: frame 0.
MOTION
The hand is not drawn by hand: five capsules, a palm and a wrist are joined in a distance field with a smooth minimum, the zero contour is traced counter-clockwise, resampled to 1024 points by arc length and decomposed with a DFT; the 64 circles are those coefficients. The Gibbs level is the measured maximum of the 7-term sum. One global angle drives everything: constant while unrolling, slower while the detail comes in, exactly seven turns in 20 s so the loop closes. The trail is a pure function of time: history of the tip while unrolling, the full closed curve of the current circles afterwards. Critically damped springs normalised to land exactly on 1, nothing overshoots; text changes only when the picture is calm.
TECHNIQUE
- One self-contained HTML page plus one JS file (no inline script, no libraries, no network requests). Stage exactly 1080×1080 CSS px, or the size named above (1080×1920 for portrait).
- Expose window.MOTION = { duration, fps: 30, width, height, seek(t) } with the stage size in width and height. seek(t) redraws the frame for time t from scratch: no state between frames, no Math.random (seeded PRNG only), no Date, no CSS transitions, no timers.
- Loop: seek(0) and seek(duration) must look identical.
- With ?render=1 the stage sits unscaled at the top left (for frame capture). Without it, scale the stage to fit the window and loop with requestAnimationFrame.
- prefers-reduced-motion: show one representative still, no loop.
CHECK
Render stills at the listed times, look at every one, fix anything that overlaps, is cut off, aliased or unreadable, then render again. Report only when frame 0 equals the last frame.
Stills: every 1 s, then every 0.1 s from 8.0 to 11.2 and from 18.0 to 19.97, in both languages; frame 0 must equal frame 19.97. How to recreate it
-
Give the prompt to a coding agent
Create an empty folder and paste the prompt into Claude Code, Codex or Cursor. The agent writes one HTML page and one script — the animation then runs right in the browser.
-
Let it check the stills
The prompt makes the agent render stills and look at them itself. Only refine what you don't like in the picture: “scene 3 is too busy” works better than a new prompt.
-
Render to MP4
Because every animation can draw any frame exactly through
window.MOTION.seek(t), a small script renders it frame by frame — no stutter, no screen recording. Then ffmpeg joins the frames into a clip.
# 1 · Render every frame (Chrome, Node ≥ 22) node render.mjs http://localhost:3000/ \ frames/ frames 30 # 2 · Join the frames into an MP4 ffmpeg -framerate 30 -i frames/%05d.png \ -c:v libx264 -preset slow -crf 22 \ -pix_fmt yuv420p -movflags +faststart \ my-motion.mp4
Background
An explainer as a motion graphic: one circle unrolls into a sine wave, seven circles approach a square wave including its Gibbs overshoot, then the time axis folds in and 64 circles draw the outline of a hand. Radii and phases come from a real decomposition, and the spectrum runs along. 20 seconds, English and German, with the prompt.
What I learned building it
A teaching film about maths must not fake anything. So I really compute the hand on load: sample the outline, decompose it with a DFT, and the 64 circles are exactly those coefficients. I did not cross-fade from the wave to the drawing; I folded the time axis in. That shows it is the same motion.
Inspiration
The starting point was a prompt by @miguel07code ((opens in a new tab)) on Skillry. You'll find the original wording there; the prompt above is my own version.
More motions
-
An agent platform, introduced UI motion 0:15 -
Agents that pick the model UI motion 0:14 -
A sentence becomes an app UI motion 0:15 -
An operating system, introduced UI motion 0:47.2 -
Your new design partner Voice-over 0:54.3 -
Ten kilometres, floating UGC ad 0:12.6 -
The journey of an order Explainer 0:34 -
Make it move Kinetic typography 0:08 -
From noise to a workflow Particles 0:14 -
The Gimli Glider Voice-over 0:19 -
Oscilloscope intro Oscilloscope 0:20 -
A keystroke in cross-section Explainer 0:20 -
A ring called Orbit UI motion 0:10 -
The bug that wants to stay Short film 0:20 -
Shin, not foot Voice-over 0:17 -
Jellyfish in a light shaft Organic loop 0:18 -
A logo that comes alive Logo reveal 0:08 -
Pixel wizard Pixel art 0:16 -
The shortest war Voice-over 0:16 -
Loose mosaic wall Mosaic 0:20 -
Near fall Physics simulation 0:09 -
A Negroni, explained Explainer 0:20 -
Where the fuel money goes Voice-over 0:19.5 -
One print, nothing else Title sequence 0:20 -
Infinite zoom into the detail Infinite zoom 0:15 -
Cube stack Short film 0:07 -
A request at 22:47 Chat story 0:17 -
Claude Code in three steps Voice-over 0:17.5 -
The inbox factory Isometric loop 0:12 -
From 0 to 100 % soft Physics simulation 0:10 -
One line, three inks Showreel 0:20 -
The request breaks out Physics simulation 0:15 -
The slicing machine Isometric loop 0:09 -
How backlinks work Explainer 0:20 -
A ball that grows with every bounce Physics simulation 0:10 -
One shape, fourteen states UI motion 0:14 -
What makes a home Paper cut-out 0:20 -
Words that carry Kinetic typography 0:20 -
Shard logo reveal Logo reveal 0:11