Skip to content

19. Animation That Feels Right

“Animation is not the art of drawings that move, but the art of movements that are drawn.”— Norman McLaren

The story: the bouncing ball and the stopwatch

Section titled “The story: the bouncing ball and the stopwatch”

In the 1930s, Disney’s animators developed a set of principles for making drawings feel alive. Decades later, two of them, Frank Thomas and Ollie Johnston, wrote them down in The Illusion of Life (1981) as the twelve principles of animation: squash and stretch, anticipation, staging, straight-ahead and pose-to-pose, follow-through and overlapping action, slow in and slow out, arcs, secondary action, timing, exaggeration, solid drawing, and appeal.

Every animation student starts with the same exercise: a bouncing ball. Get the timing wrong and it floats. Get the easing wrong and it feels like a robot moved it. Get the squash wrong and it’s made of stone. Get it right and you believe it has weight.

Now give that animator a stopwatch and a rule: every drawing must be finished within 16 milliseconds, or the audience sees a stutter — and while you’re drawing, nobody can talk to you. That’s UI animation on the web. You need the animator’s sense of feel and the engineer’s sense of budget. Most teams have one or the other. You, as a designer-engineer, can have both. This chapter connects them.

Not all twelve map to interfaces, but several are essential:

  • Timing — duration communicates weight and importance. Small UI changes: ~100–200 ms. Larger panels and page transitions: ~200–400 ms. Beyond ~500 ms, UI motion starts to feel slow, because users are waiting on it.
  • Slow in and slow out (easing) — real objects accelerate and decelerate. Linear motion looks mechanical. Ease-out (fast start, gentle stop) for things entering or responding to the user — it feels responsive because the change starts immediately. Ease-in (slow start, fast exit) for things leaving. Ease-in-out for things moving from one place to another on screen.
  • Anticipation and follow-through — a slight wind-up before a big move, a slight overshoot and settle after. Springs give you follow-through for free.
  • Arcs — natural motion follows curves, not straight lines. Subtle in UI, but a card that arcs into place feels more physical.
  • Staging — direct attention to one thing at a time. Don’t animate twelve things simultaneously.
  • Overlapping action / stagger — elements in a group arriving slightly out of sync (staggered by 20–40 ms) feel organic; all at once feels like a slide changing.
  • Exaggeration, used sparingly, makes feedback legible (a shake on a wrong password).

Motion in UI has a job: orient (where did this come from, where did it go?), give feedback (your tap registered), show relationships (this thumbnail becomes that hero), and express character. Motion without a job is decoration, and decoration has a cost — in budget, in attention, and for some users, in physical discomfort.

Try it: same distance, same duration, different feel

What you'd see: five dots travel the same distance in the same time. Linear looks mechanical; ease-out arrives gently and feels responsive (great for things entering); ease-in starts slowly and feels sluggish if used for entrances (great for exits); the spring overshoots slightly and settles, which reads as physical. All five are transform animations, so they run on the compositor. With reduced motion on, the dots jump instantly to their end positions.

Animate between two states when a property changes:

.card { transition: transform 200ms cubic-bezier(.2,.8,.2,1), opacity 200ms; }
.card:hover { transform: translateY(-4px); }

Declarative, cheap, interruptible (a transition reverses smoothly if the state changes mid-way). Best for state changes: hover, focus, open/closed. Modern additions make them more capable: @starting-style lets an element animate in when it’s first displayed (e.g., a popover appearing), and transition-behavior: allow-discrete lets you transition properties like display and overlay so exit animations can finish before an element disappears.

Keyframe sequences that run on their own:

@keyframes pulse { 50% { transform: scale(1.04); } }
.badge { animation: pulse 1.6s ease-in-out infinite; }

Best for looping or multi-step motion that isn’t driven by a state change.

The JavaScript interface to the same engine (Chapter 14): element.animate(keyframes, options) returns an Animation you can pause, reverse, scrub and await. Best when animation is driven by logic (sequences, interruptions, gestures) but should still run on the native engine — and therefore, for compositor-friendly properties, off the main thread.

function frame(t) {
el.style.transform = `translateX(${position(t)}px)`;
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);

Full control — physics, gestures, canvas — but every frame runs on the main thread. If the main thread is busy, the animation drops frames, even though it’s animating transform. That’s the key difference from CSS/WAAPI: a CSS transform animation can be handed to the compositor; a rAF loop that sets transform each frame cannot.

  • Motion (the library formerly known as Framer Motion, now framework-agnostic as well as React) — declarative React animations, layout animations, gestures, springs; uses the Web Animations API under the hood where it can, to get compositor acceleration.
  • GSAP — a long-established, powerful timeline-based animation library with extensive plugins (scroll triggers, morphing), now free to use. Drives animations from JavaScript (so main-thread-bound per frame), very optimized.
  • Smaller tools: CSS-only utilities, spring-to-linear() generators, React Spring.

Choose libraries for capability (complex choreography, gestures, layout animation), not for simple transitions CSS already does well.

Chapter 10, applied:

  • Compositor-friendly: transform (translate, scale, rotate) and opacity, animated by CSS transitions/animations or WAAPI, on elements with their own layer. Also some filter animations in Chromium. These keep running at full frame rate even when the main thread is blocked.
  • Main thread every frame: anything set from a rAF loop; layout properties (width, height, top, left, margin, padding, font-size); paint properties (background-color, box-shadow, border-radius, color), which repaint each frame.
Animation techniques and threadsA two-by-two grid. Rows: CSS or WAAPI versus JavaScript rAF loop. Columns: transform and opacity versus layout or paint properties. Only the CSS/WAAPI with transform/opacity cell is green, labelled compositor, survives jank. The other three are yellow or red, labelled main thread every frame.transform / opacitywidth, top, shadow, color…CSS / WAAPIJS rAF loopcompositorsurvives jank ✓main threadlayout/paint each framemain threadJS each frame, cheap rendermain threadJS + layout/paint each frame
Figure 19.1. Which animations survive a busy main thread. Only native (CSS/WAAPI) animations of transform and opacity are handed to the compositor; everything else needs the main thread for every frame.

FLIP: animating layout without animating layout

Section titled “FLIP: animating layout without animating layout”

You want a card to move from the grid into a detail view, or a list to reorder smoothly. That’s a layout change — new positions and sizes — which you can’t animate cheaply with top/width. FLIP (coined by Paul Lewis) solves it:

  1. First — measure the element’s current position and size (getBoundingClientRect()).
  2. Last — apply the layout change (move it in the DOM, change the class) and measure again.
  3. Invert — apply a transform that makes it look like it’s still in the First position: translate by the difference, scale by the ratio.
  4. Play — animate the transform back to none.
const first = el.getBoundingClientRect();
moveToNewLayout(el); // DOM/class change
const last = el.getBoundingClientRect();
const dx = first.left - last.left, dy = first.top - last.top;
const sx = first.width / last.width, sy = first.height / last.height;
el.animate(
[{ transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` }, { transform: 'none' }],
{ duration: 300, easing: 'cubic-bezier(.2,.8,.2,1)' }
);

The expensive layout happens once (step 2); the motion is a compositor transform. Caveats: scaling distorts children (text squashes) — counter-scale children or cross-fade; measure all elements before mutating any (or you’ll thrash layout, Chapter 10). Motion’s layout animations and the View Transitions API both automate FLIP-style animation.

FLIP techniqueFour panels. First: a small card at the top left, measured. Last: the card moved to a large detail position, measured. Invert: a transform makes the large card look small at the original position. Play: the transform animates to none and the card grows into place.FirstmeasureLastchange layout, measureInverttransform backPlayanimate transform → none
Figure 19.2. FLIP. Do the layout change instantly, then use a transform to pretend nothing moved, and animate the transform away — layout cost once, compositor motion after.

A spring animation simulates a mass on a spring with damping, instead of following a fixed curve over a fixed duration. Parameters like stiffness, damping and mass define it. Why designers love them:

  • Natural follow-through: slight overshoot and settle (if underdamped) reads as physical.
  • Interruptible with velocity: if a gesture flings a sheet, the spring starts with the gesture’s velocity and settles from there. A duration-based curve can’t do that naturally.
  • Duration emerges from physics, so motion feels consistent across distances.

Implementation options: a JS spring solver in a rAF loop (main thread), a library (Motion’s springs can be converted to WAAPI where possible), or CSS’s linear() easing function, which lets you approximate any curve — including a spring’s — with many points, as a native, compositor-capable animation (the demo above samples a spring into linear()). The trade-off: a precomputed linear() spring can’t respond to a live gesture’s velocity.

Scroll-driven animations link an animation’s progress to scroll position instead of time, in CSS:

.progress { animation: grow linear both; animation-timeline: scroll(); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.reveal { animation: fade-up linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }

scroll() ties progress to a scroll container’s position; view() ties it to an element’s visibility within its scroller (entering, crossing, exiting). Because they’re declarative and can run on the compositor for transform/opacity, they replace a whole category of scroll-listener JavaScript — reading progress bars, parallax, reveal-on-scroll — that used to run on the main thread on every scroll event (and often forced layout). Chromium shipped them first; other engines have followed. Feature-detect with @supports (animation-timeline: scroll()) and fall back to no animation or to IntersectionObserver-triggered transitions.

View Transitions, from the motion designer’s side

Section titled “View Transitions, from the motion designer’s side”

Chapter 10 covered the mechanism. For motion design, View Transitions give you a stage: the old view and new view as snapshot layers, plus named elements that can morph between their old and new geometry. You choreograph with CSS:

::view-transition-old(root) { animation: 160ms ease-in both fade-out; }
::view-transition-new(root) { animation: 240ms cubic-bezier(.2,.8,.2,1) both slide-in; }
.thumbnail.active, .hero { view-transition-name: essay-hero; } /* morph thumbnail → hero */

Good practice: keep page transitions short (~200–300 ms), let shared elements carry the user’s eye, and always design the reduced-motion version (a quick cross-fade or no transition).

“It feels smooth to me” is not evidence. To measure:

  • Performance panel recording while the animation runs, with CPU throttling and ideally on a real phone (Chapter 17). Look at the Frames track: green frames are good; dropped frames (no update when one was expected) and partially presented frames (some content updated — e.g., compositor-driven parts — but main-thread content missed the deadline) show where motion broke. Then look at what the main thread was doing during the bad frames.
  • Rendering tab → Frame rendering stats for a live FPS and frame-time overlay.
  • Paint flashing to see if an animation repaints more than it should.
  • In the field, Long Animation Frames (Chapter 16) attribute slow frames to scripts.

Watch for consistency, not averages: an animation at a steady 60 with one 100 ms hitch at the start (because it started at the same moment as a data fetch’s JSON parse) feels broken. Fix the start: preload, prepare layers just before (will-change added a frame early), and don’t start motion at the same moment as heavy work.

Some people experience nausea, dizziness, migraines or distraction from motion — particularly large-scale motion like parallax, zooming, spinning and full-screen slides. Operating systems let them ask for reduced motion; browsers expose it as prefers-reduced-motion: reduce.

The lazy implementation is a global kill switch:

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

It’s better than nothing, but it throws away motion that helps: feedback that a toggle switched, a fade that shows content changed, a progress indicator. And !important resets can break components that rely on animation events to finish.

Doing it well:

  • Reduce, don’t remove. Replace movement with fades: a slide-in panel becomes a quick opacity fade; a zoom transition becomes a cross-fade; a parallax background becomes static.
  • Keep functional feedback, shorter and subtler: pressed states, focus rings, a spinner (consider a non-rotating progress indicator).
  • Stop autoplaying motion: background videos, looping animations, auto-advancing carousels. Provide play controls.
  • Remove scroll-linked motion (parallax, scroll-driven transforms) or replace it with static states.
  • Respect it in JavaScript too: matchMedia('(prefers-reduced-motion: reduce)') for WAAPI, libraries and canvas/WebGL scenes (render a still frame).
  • Design both versions in the motion spec, not as an afterthought.
.panel { transition: transform 280ms var(--ease-out), opacity 280ms; }
@media (prefers-reduced-motion: reduce) {
.panel { transition: opacity 150ms linear; transform: none; }
}

Here’s where your designer side and engineer side meet. Engineers can’t implement “make it feel bouncy.” They can implement a spec. A good motion spec, per interaction, contains:

Field Example
Trigger Tap on gallery thumbnail
Elements Thumbnail image → essay hero (shared element); rest of gallery; essay body
Properties Hero: transform (translate + scale) via FLIP / view-transition-name. Gallery: opacity 1 → 0. Body: opacity 0 → 1, translateY 12px → 0
Duration Hero 320 ms; gallery fade 160 ms; body 240 ms
Delay / stagger Body starts at 120 ms; list items stagger 30 ms
Easing Hero: cubic-bezier(0.2, 0.8, 0.2, 1) (ease-out); exits: cubic-bezier(0.4, 0, 1, 1) (ease-in). Or spring: stiffness 300, damping 30
Interruptibility If Back is pressed mid-transition, reverse from current position
Performance contract Only transform/opacity; must hold 60 fps on reference mid-range Android; no layout properties
Reduced motion Cross-fade 150 ms; no movement
Weak-device tier Same as reduced motion, or no transition
Reference Prototype link + a recorded video at 0.25× speed

Encode the reusable parts as design tokens: named durations (--dur-quick: 120ms, --dur-standard: 240ms), named easings (--ease-out, --ease-in, --ease-emphasized), spring presets. Then specs reference tokens, engineers use the same tokens, and changing the feel of the whole product is one edit.

Motion spec timelineA timeline from 0 to 400 milliseconds with rows: hero morph from 0 to 320 milliseconds with ease-out; gallery fade from 0 to 160 with ease-in; body fade-up from 120 to 360 with ease-out; list items staggered by 30 milliseconds starting at 160. A note at the bottom: reduced motion is a 150 millisecond cross-fade.0100200300400 msHero (morph)transform · 320 ms · ease-outGallery (exit)opacity · 160 ms · ease-inBody (enter)opacity+translateY · 240 msList itemsstagger 30 msReduced motion: 150 ms cross-fade, no movement · Contract: transform/opacity only, 60 fps on reference Android
Figure 19.3. A motion spec on a timeline. Each row is an element; bars show delay, duration and easing. This is the artifact that makes 'feel' implementable and reviewable.

The accordion that stuttered on Android. Animating height from 0 to auto with JS: smooth on desktop, choppy on phones, because every frame relays out the page below. Fix: animate grid-template-rows: 0fr → 1fr (layout, but scoped and cheap in modern engines) or clip-path/transform with a FLIP, or — newer — use interpolate-size where supported. Better still, question whether the content should animate at all.

The parallax that made people sick. A marketing site with heavy multi-layer scroll parallax and no reduced-motion path generated complaints from users with vestibular disorders. Fix: honour prefers-reduced-motion, reduce parallax depth, never scroll-jack.

The “smooth” page transition that delayed every navigation. A team added 600 ms exit animations to every route change, and the next page’s data fetch didn’t start until the exit finished. Navigations felt slower despite looking polished. Fix: start loading at the click, run exit and fetch in parallel, keep transitions under ~300 ms.

You can apply the animation principles that matter for UI; choose between CSS transitions, CSS animations, WAAPI, rAF loops and libraries; say exactly which animations run on the compositor; implement FLIP; use springs (and linear()); build scroll-driven animations; choreograph View Transitions; measure smoothness with dropped and partially presented frames; implement reduced motion that reduces rather than removes; and hand off motion as a precise spec with tokens and a performance contract.

1. Why does ease-out feel responsive for entering elements?

Motion starts fast immediately after the trigger, then settles gently — the change is visible at once.

2. Can a rAF loop that sets transform survive a blocked main thread?

No — the loop itself runs on the main thread. Only native CSS/WAAPI transform/opacity animations can run on the compositor.

3. What does FLIP stand for and why does it work?

First, Last, Invert, Play. Layout is computed once; the visible motion is a compositor transform.

4. What can a spring do that a fixed curve can’t?

Start from an arbitrary velocity (e.g., a gesture) and settle naturally; duration emerges from physics.

5. What’s wrong with the global animation: none !important approach?

It removes helpful feedback, can break components relying on animation events, and doesn’t replace motion with gentler alternatives.

Warm-up 1. Pick the easing. A toast entering; a modal leaving; a card moving between two grid cells.

Solution

Ease-out; ease-in; ease-in-out (or a spring).

Warm-up 2. Compositor or not? CSS animation of transform: rotate; GSAP tween of x; WAAPI animation of opacity; CSS transition of box-shadow.

Solution

Yes; no (JS per frame); yes; no (repaint each frame).

Warm-up 3. Reduce it. Write the reduced-motion version of: a full-screen slide-in menu with a staggered list.

Solution

Menu fades in over ~150 ms with no translation; list items appear together (no stagger) or with a very short fade.

Lab 4. FLIP Lumen’s gallery. When a filter changes the gallery’s order, animate items to their new positions with FLIP (or Motion’s layout animation). Profile on 4× throttle.

Expected outcome

One layout per change, smooth transform animation, no forced reflows in the loop (measure all first).

Lab 5. Thumbnail → hero. Implement the gallery-to-essay transition with View Transitions and a shared view-transition-name, with a reduced-motion cross-fade.

Hint

Assign the name only to the clicked thumbnail (one element per name at a time), then to the hero on the new view.

Lab 6. Scroll progress, no JS. Add a reading-progress bar to Lumen essays using a scroll-driven animation, with a fallback for unsupported browsers.

Expected outcome

Smooth progress bar with zero scroll listeners; in unsupported browsers it’s hidden or static.

Lab 7. Motion tokens. Define duration and easing tokens for Lumen and refactor every transition to use them. Change one token and watch the whole site’s feel shift.

Expected outcome

A single source of truth for motion; consistent feel across components.

Staff 8. Write the spec. Using the format above, write a complete motion spec for a bottom sheet that can be dragged, flung and dismissed, including reduced motion and a performance contract.

Model points

Gesture-driven translateY on the compositor where possible (or rAF with minimal work); spring settle with fling velocity; snap points; backdrop opacity linked to position; interrupt rules; reduced motion = no drag animation, instant snap with fade; 60 fps on reference Android.

Staff 9. The motion budget debate. Product wants richer animations everywhere. Write a half-page proposing a motion budget that keeps the product fast and accessible.

Model answer

Every animation has a job; transform/opacity only by default; duration caps; at most one prominent animation per view; reduced and weak-device tiers mandatory; measured on the reference phone before shipping.