A ball that grows with every bounce
A physics simulation in portrait: a ball that gets bigger with every bounce
- 0–2.16 s the small ball is tossed up, falls and zigzags across the floor
- 2.16–4.99 s a steady rhythm, every bounce makes the ball 7 % bigger and leaves light on the ring
- 4.99–7.35 s the ball now hits the top as well, the gaps get shorter
- 7.35–9.2 s the bounces tumble over each other, the last one does not let go, the ball fills the ring and pushes it outwards
- 9.2–10 s the ball pops, its skin runs out over the ring, the core shrinks back to the start ball, the counter runs to zero
- Physics simulation
- 10 s Loop
- 1080 × 1920 · 30 fps
- Canvas 2D
- 666 KB
Prompt
Build a 10-second looping physics short in portrait 9:16 — stage 1080×1920 CSS px (not square) — after the format "A ball, but every bounce makes it bigger": a ball bounces inside a ring under gravity, every bounce makes it 7 % bigger, faster and denser, until it fills the ring and pops back into the ball it started as.
DESIGN
Dark, minimal, one light from the top left. Ground #0D0E12 with a faint grey light falling from the top left; inside the ring an arena a hair lighter (#13151B). Ring: centre (540, 930), radius 390, 4 px stroke in #2E323B. Ball: flat colour from a nine-step palette (#FF5D5D, #FF8A3D, #FFC145, #B8E04A, #3FD8A0, #35C2E8, #4C8DFF, #8A6CFF, #E35FD1), a soft white highlight top left, a dark falloff bottom right, a soft radial shadow offset down-right and clipped to the arena. Hook in Geist 600 60 px, two centred lines at y 300/376 ("A ball, but every bounce / makes it bigger"; DE "Ein Ball, der mit jedem / Aufprall wächst"); the last word carries the ball's colour. Below the ring a counter in Geist Mono 46 px, "bounces: 07" (label grey, two digits white) and under it "size ×1.00" in 26 px. Keep the top 10 %, the bottom 22 % and the right 12 % free of anything important. Banned: particles, confetti, coloured glows on text, bouncy easing.
STORYBOARD
0–2.16 The start ball (r 44) is tossed up out of the top left and falls; the first five bounces zigzag across the floor.
2.16–4.99 A steady left-right rhythm; each bounce: +7 % radius, one palette step, a flash on the ring.
4.99–7.35 The ball now hits the top as well; the gaps shrink from about 0.35 s to 0.22 s.
7.35–9.2 Climax: bounces every 0.08–0.2 s. The last one (31, at 8.44) does not let go — the ball grows on until it fills the ring; from 8.78 the ring bulges 9 px and the ball lightens a little.
9.2–10 Pop: white flash on the ball, its skin runs out over the ring as a thin wave, the whole ring flashes. The core collapses (radius ease-out quintic) along a Hermite curve back to the start position and arrives with the start velocity, so frame 0 follows without a seam. The counter's two digits drop out of their mask one after the other and 00 drops in from above, the colour steps back through the palette.
MOTION
Real physics: gravity 5249 px/s², elastic reflection about the wall normal, growth as a critically damped spring 1 − (1 + w·t)·e^(−w·t) (w = 38). Solve it offline with exact contact times (ballistic flight between contacts, bisection on |p| + r = R) and store every contact as a table, so each frame is closed-form in t and identical in every browser. Squash on contact: flatten along the normal by up to 30 %, keeping the wall-side extent exact; in flight a slight stretch along the velocity, never past the gap to the wall. Ring per bounce: a white-hot flash at the contact (70 ms), an afterglow in the ball's colour that spreads along the ring and fades (0.85 s), a dent that springs back critically damped; the ring path is a Catmull-Rom through 240 samples with a conic gradient as its stroke, the glow as additive nested strokes. Hold the previous loop's afterglow at the start. Motion blur: average 16 samples of the ball over half a frame as a running mean on opaque copies (a premultiplied sum leaves banding). Counter digits roll as an odometer in 0.14 s, a new digit starts in the ball's colour. The hook word glides through the palette instead of stepping. ?lang=de|en switches the texts.
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 0.5 s from 0 to 10, plus every 0.1 s across 1.66–2.66, 4.49–5.49, 6.85–7.85, 7.94–8.94, 8.7–9.7 and the loop seam 9.5–0.5 — in both languages, with 2× and 3× crops of the contact, the counter and the ring edge. 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
A ball bounces inside a ring, and every bounce makes it 7 % bigger, changes its colour and speeds it up, until it fills the ring and pops back into the ball it started as. 10 seconds, 9:16, built as code — with a prompt to recreate it.
What I learned building it
Real physics and a perfect loop only get along when the simulation is solved beforehand: I computed every bounce with its exact time and stored it as a table, with the flight in between in closed form. Then every frame is a pure function of time, and the end can fall exactly back into the start.
Inspiration
The model was a video by @jdg_creative ((opens in a new tab)) on TikTok. What I built is my own take on the format, not the video itself; the prompt above describes exactly this 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 -
How circles draw any shape Explainer 0:20 -
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 -
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