Skip to content

Follow-through & overlapping action

Parts keep moving after the body stops: staggered lists, trailing tails.

Edit this page

When 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.

Now showing: Follow-throughOpen the Follow-through demo on its own page (opens in a new tab)
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 &amp; 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 &amp; 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>

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:

Now showing: CSS follow-throughOpen the CSS follow-through demo on its own page (opens in a new tab)

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.

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.

  • 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-overlap does in CSS.

For every option, see the Canvas Spring and Chain and the CSS .toon-follow preset.