Follow-through & overlapping action
Parts keep moving after the body stops: staggered lists, trailing tails.
Edit this pageWhen a body stops, its loose parts (a tail, hair, ears, a cape) keep going, swing past, then settle back. That’s follow-through. Overlapping action is the companion idea: parts move at different rates and start at different times, so nothing moves in lock-step.
Move your pointer over the canvas, or watch the autopilot dart and stop.
Show the demo's source
The complete page: it loads toon.css and toon.js, plus demo-theme.js (theme colors), demo-runtime.js (gives the demo its own clock) and, for the characters, cast.js.
<!doctype html><html lang="en" data-style="saturday"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>05 · Follow-through & overlapping action — toon</title><link rel="stylesheet" href="../src/toon.css"><link rel="stylesheet" href="demo.css"><style> body { font-size: 15px; line-height: 1.5; max-width: var(--demo-max-width); margin: 2rem auto; padding: 0 1rem; } canvas { display: block; width: 100%; height: 340px; margin-bottom: var(--space-sm); }</style></head><body><h1>Follow-through & overlapping action</h1><p>Zip stops; its speed-lines keep going, swing past and settle (follow-through). Each line lags by a different amount (overlapping action).</p><canvas id="c" style="cursor:crosshair" role="img" aria-label="Zip darts around and stops. Its three speed-lines keep moving, swing past and settle, each a little behind the others."></canvas><p class="demo-try">Move your pointer over the canvas, or watch the autopilot dart and stop.</p>
<script src="../src/toon.js"></script><script src="demo-theme.js"></script><script src="cast-shapes.js"></script><script src="cast.js"></script><script src="demo-runtime.js"></script><script>ToonDemos.register('05-follow-through', (document, Toon, DemoTheme) => { const T = DemoTheme; // design tokens, live (see demo-theme.js) const { createStage, ticker, Spring, Chain } = Toon; const stage = createStage(document.getElementById('c')); const { ctx } = stage; const springy = { stiffness: 90, damping: 11 }; // slightly under-damped: the body itself overshoots const head = { x: new Spring(200, springy), y: new Spring(170, springy) }; const H = 60; // Zip's body height on screen // three speed-lines, each a short rope hanging off Zip's tail, with its own length and damping (overlap) const tip = Cast.shapes.zip.tail; const lines = [[-6, -12, 4, 0.9], [-12, 2, 5, 0.93], [-4, 16, 3, 0.88]].map(([dx, dy, n, damping]) => ({ at: [tip[0] + dx, tip[1] + dy], chain: new Chain(n, { x: 200, y: 170, length: 7, damping, stiffness: 0.12 }) })); let flip = false; let target = { x: 200, y: 170 }, lastPointer = -9, nextHop = 0;
stage.canvas.addEventListener('pointermove', e => { const r = stage.canvas.getBoundingClientRect(); target = { x: e.clientX - r.left, y: e.clientY - r.top }; lastPointer = ticker.time; });
stage.loop((dt, t) => { if (t - lastPointer > 2 && t > nextHop) { // autopilot: dart, then hold still target = { x: 60 + Math.random() * (stage.width - 120), y: 60 + Math.random() * (stage.height - 120) }; nextHop = t + 1.8; } head.x.target = target.x; head.y.target = target.y; const hx = head.x.step(dt), hy = head.y.step(dt), vx = head.x.velocity, vy = head.y.velocity; if (Math.abs(vx) > 40) flip = vx < 0; // face the way it's going const pose = { x: hx, y: hy, h: H, flip }; for (const l of lines) l.chain.update(Cast.anchor('zip', pose, l.at), dt);
stage.clear(); ctx.lineCap = 'round'; ctx.lineJoin = 'round'; ctx.strokeStyle = T.ink; ctx.lineWidth = 2.6; for (const l of lines) { // [FOLLOW-THROUGH] speed-lines drag, overshoot, settle ctx.beginPath(); l.chain.points.forEach((p, i) => (i ? ctx.lineTo(p.x, p.y) : ctx.moveTo(p.x, p.y))); ctx.stroke(); } const speed = Math.hypot(vx, vy), clamp = v => Math.max(-1, Math.min(1, v)); Cast.draw(ctx, 'zip', { ...pose, fill: T.tertiary, ink: T.ink, trail: false, mood: speed > 650 ? 'happy' : 'neutral', look: { x: clamp(Math.abs(vx) / 300), y: clamp(vy / 300) } }); });
});</script></body></html>Follow-through in CSS
Section titled “Follow-through in CSS”Add .toon-follow to a list, and its items slide in one after another and swing past the stop. This snippet runs as-is:
<link rel="stylesheet" href="toon.css">
<ul class="toon-follow" style="--toon-overlap:70ms; list-style:none; margin:0; padding:0; display:grid; gap:8px"> <li style="padding:12px 16px; border:2px solid; border-radius:10px">Pack the bag</li> <li style="padding:12px 16px; border:2px solid; border-radius:10px">Grab the keys</li> <li style="padding:12px 16px; border:2px solid; border-radius:10px">Lock the door</li></ul><button id="replay">Replay</button>
<script>const list = document.querySelector('.toon-follow');document.querySelector('#replay').onclick = () => { list.classList.remove('toon-follow'); void list.offsetWidth; // reflow, so the class list.classList.add('toon-follow'); // plays again};</script>Below, the same list with a fill behind each card:
Press Replay to run it again.
- Pack the bag
- Grab the keys
- Lock the door
Each item starts --toon-overlap (70 ms by default) after the one before it. It turns from its top edge, so its bottom swings past the stop and wobbles back; use .toon-settle for the same entrance on one element.
Follow-through in Canvas
Section titled “Follow-through in Canvas”This ball runs as-is. The body follows its target on a slightly under-damped Spring, so it overshoots a little. Each antenna is a Chain (simple rope physics) with its own length and damping, so the two drag, swing past and settle out of step.
<script src="toon.js"></script><canvas style="width:100%; height:180px" role="img" aria-label="A ball slides from side to side and stops. Its two antennae trail behind, swing past the stop, then settle, one a little after the other"></canvas>
<script>const { createStage, Spring, Chain } = Toon;const stage = createStage(document.querySelector('canvas'));const r = 22, cy = stage.height - 20 - r; // radius, centerconst x0 = stage.width * 0.3; // where the ball starts// Slightly under-damped: the body overshoots a little too.const body = new Spring(x0, { stiffness: 90, damping: 11 });// Two antennae with their own length and damping, so they// don't swing in step (overlapping action). Negative gravity// makes a chain stand up; stiffness keeps it from flopping.const antennae = [[5, 0.93], [6, 0.97]].map(([n, damping]) => new Chain(n, { x: x0, y: cy - r, length: 10, damping, gravity: -3000, stiffness: 0.25 }));let time = 0;
function step(dt) { time += dt; // Dart to the other side every 1.6 seconds, then hold. const right = Math.floor(time / 1.6) % 2 === 0; body.target = stage.width * (right ? 0.7 : 0.3); const x = body.step(dt); antennae.forEach((c, i) => c.update({ x: x - 8 + i * 16, y: cy - r + 6 }, dt));}// Start as the ball stops, with the antennae swinging past.for (let i = 0; i < 18; i++) step(1 / 60);4 collapsed lines
// Reduced motion: freeze the clock on that frame.if (matchMedia('(prefers-reduced-motion: reduce)').matches) { Toon.ticker.timeScale = 0;}
stage.loop((dt) => { if (dt > 0) step(dt); const ctx = stage.ctx;4 collapsed lines
// Colors from the page: --toon-color for fills, text for ink. const fill = getComputedStyle(document.documentElement) .getPropertyValue('--toon-color').trim() || '#ff6b4a'; const ink = getComputedStyle(document.body).color; stage.clear(); ctx.fillStyle = ink; ctx.fillRect(0, cy + r, stage.width, 2); ctx.lineCap = ctx.lineJoin = 'round'; ctx.strokeStyle = ink; ctx.lineWidth = 2.5; for (const c of antennae) { // stalk, then a knob on top ctx.beginPath(); c.points.forEach((p) => ctx.lineTo(p.x, p.y)); ctx.stroke(); const tip = c.points[c.points.length - 1]; ctx.beginPath(); ctx.arc(tip.x, tip.y, 5, 0, Math.PI * 2); ctx.fillStyle = fill; ctx.fill(); ctx.stroke(); } ctx.beginPath(); ctx.arc(body.value, cy, r, 0, Math.PI * 2); ctx.fillStyle = fill; ctx.fill(); ctx.stroke();});</script>Follow-through: tuning tips
Section titled “Follow-through: tuning tips”- Let lighter parts lag more. Hair and fabric overlap more than limbs. Give each chain its own
damping, closer to 1 for the floppiest parts. - Keep the settle short. Two or three shrinking swings are plenty. A long wobble looks like jelly.
- Keep stagger delays small. 40–90 ms between items reads as one fluid motion. Longer gaps read as separate events.
- Stagger scripted sequences too. In Canvas,
Toon.stagger(items, fn, { each: 80 })starts each item 80 ms after the last, like--toon-overlapdoes in CSS.
For every option, see the Canvas Spring and Chain and the CSS .toon-follow preset.