Mrs. Sri welcomes guests at Mist Homestay with just the right movement. When you book, she nods (a sign your booking was heard). When you look lost, she points toward your room. Then she walks you from the front desk to the room door, so you never suddenly "appear" somewhere else. She does not dance in front of you for no reason. For a guest who gets dizzy easily, she just talks quietly without moving much. The animation on her booking page has to behave like Mrs. Sri: it moves only when there is a reason. On the web, motion design means deciding why an element moves, for how long, in what order, and for whom it should stay still.
Three reasons something may move
Mrs. Sri's three movements above are the three reasons in this table: nodding is feedback, pointing is orientation, and walking you to your room is continuity.
| Reason | What it says | On Mrs. Sri's page |
|---|---|---|
| Feedback | "your action was received" | the "2 nights" button shrinks to scale(0.96) for 100 ms, the total rises 4 px |
| Orientation | "look here" | the "Book the Terrace Room?" dialog appears in the middle, with the background dimmed |
| Continuity | "this is the same thing, only moved" | a gallery photo slides 300 ms to the next one instead of swapping at once |
If a movement has none of these three reasons, delete it. Apple's Human Interface Guidelines (Apple's design guide), on the Motion page, put this rule as the first piece of advice: "Add motion purposefully, supporting the experience without overshadowing it."
The 12 principles of animation, brought to UI
Frank Thomas and Ollie Johnston, two Disney animators, described these twelve principles in the book Disney Animation: The Illusion of Life (Abbeville Press, 1981), chapter "The Principles of Animation". Cartoons use them with exaggerated movement. UI uses the subtle version. This table shows each principle in UI, with an example from Mrs. Sri's booking flow:
| Principle | In UI | Example in the booking flow |
|---|---|---|
| 1. Squash and Stretch | the shape gives a little when pressed | the button's scale(0.96) |
| 2. Anticipation | a small movement before the main action | the button shrinks first, then the dialog appears |
| 3. Staging | one focus at a time | the dialog in the middle, background dimmed |
| 4. Straight Ahead Action and Pose to Pose | pose to pose = keyframes; straight ahead = computed frame by frame | the card's @keyframes vs the canvas confetti |
| 5. Follow Through and Overlapping Action | parts do not all stop together | cards entering 60 ms apart |
| 6. Slow In and Slow Out | speeding up and slowing down, that is easing | ease-out to enter, ease-in to leave |
| 7. Arcs | curved paths for long moves | rarely used on small cards |
| 8. Secondary Action | a supporting movement that does not steal focus | the "saving" dots in the button |
| 9. Timing | duration sets the character | 100 ms press, 300 ms card |
| 10. Exaggeration | a little overdone so it reads | a small spring overshoot, used sparingly |
| 11. Solid Drawing | shapes and depth stay consistent | the shadow of a card flipped in 3D |
| 12. Appeal | pleasant to watch, true to the character | Mist Homestay's calm green, nothing loud |
The principle that adds a small movement before the main action is Anticipation. A cartoon example: a character crouches before jumping. Slow In and Slow Out (ease in and ease out) is different: it controls speeding up within one movement, not an extra movement before it.
Material 3 tokens and Apple's advice
Material 3, Google's design system (a set of rules for how an interface looks), gives a name to each easing and duration. Such a name is called a token. With tokens, a whole team uses the same numbers. How to pick an easing and a duration is in the Easing & Timing Functions lesson.
| Token | Value |
|---|---|
md.sys.motion.easing.emphasized |
a two-segment curve; the web tokens write it as cubic-bezier(0.2, 0, 0, 1) |
md.sys.motion.easing.emphasized-decelerate (enter) |
cubic-bezier(0.05, 0.7, 0.1, 1) |
md.sys.motion.easing.emphasized-accelerate (exit) |
cubic-bezier(0.3, 0, 0.8, 0.15) |
md.sys.motion.easing.standard |
cubic-bezier(0.2, 0, 0, 1) |
md.sys.motion.duration.short1 to short4 |
50, 100, 150, 200 ms |
medium1 to medium4 |
250, 300, 350, 400 ms |
long1 to long4 |
450, 500, 550, 600 ms |
The other advice on Apple's Motion page you will use most on the web:
- "Make motion optional." Motion can be turned off.
- "Aim for brevity and precision in feedback animations." Keep feedback animations short and exact.
- "In apps, generally avoid adding motion to UI interactions that occur frequently." In apps, usually avoid motion on actions that happen often.
- "Let people cancel motion." Motion can be stopped.
On Mrs. Sri's page, this means: a button pressed dozens of times needs no bounce, and the other buttons stay clickable while an animation runs.
For duration, Page Laubheimer of Nielsen Norman Group (NN/g, a research group on how easy websites are to use) wrote on 9 February 2020 that most UI animations last 100 to 500 ms. Simple feedback, such as a checkbox or a toggle (an on/off switch), takes around 100 ms. A modal window (a window on top of the page, like the confirmation dialog) takes 200 to 300 ms. Laubheimer also wrote: "At 500ms, animations start to feel like a real drag for users." In other words, from 500 ms an animation feels slow and tiring. So a micro-interaction (a small movement that answers one action, for example on a button or a tooltip) sits at 100 to 300 ms.
Choreographing the booking flow
Choreography is the order of movements and the gaps between them. This table shows the choreography of Mrs. Sri's flow, from the night button to the toast. The times +150 ms and +350 ms count from the click on "Yes, book":
| Time | What moves | Duration, easing | Reason |
|---|---|---|---|
| 0 ms | the "2 nights" button shrinks, its colour turns green | 100 ms ease-out, colour 150 ms |
feedback |
| 0 ms | the total becomes $70, rising 4 px | 200 ms ease-out |
feedback |
| click "Book the room" | the dialog enters, background dimmed | 200 ms ease-out |
orientation |
| click "Yes, book" | the dialog leaves | 150 ms ease-in |
continuity |
| +150 ms | the toast enters | 200 ms ease-out |
feedback |
| +350 ms | the 5-second bar runs | 5,000 ms linear |
time left |
The rules: one focus at a time (the toast only enters after the dialog has left), exits faster than entries (150 ms and 200 ms), and no movement locks the buttons.
Motion and accessibility
Some people have a vestibular disorder (a problem with the balance organ in the inner ear). According to the explanation in WCAG (the web accessibility guidelines), unnecessary motion can trigger dizziness, nausea and headaches. Examples are parallax (a background that moves more slowly than the page content when you scroll) and elements that shift while you scroll. That is why the prefers-reduced-motion media query ("Reduce motion", from the first lesson) exists. Two WCAG 2.2 criteria (rules that can be checked) govern motion. Level A is the most basic level, AAA the strictest.
- 2.3.3 Animation from Interactions (Level AAA): "Motion animation triggered by interaction can be disabled, unless the animation is essential to the functionality or the information being conveyed."
- 2.2.2 Pause, Stop, Hide (Level A): "For any moving, blinking or scrolling information that (1) starts automatically, (2) lasts more than five seconds, and (3) is presented in parallel with other content, there is a mechanism for the user to pause, stop, or hide it unless the movement, blinking, or scrolling is part of an activity where it is essential". In plain words: movement that starts by itself, lasts more than 5 seconds and shows next to other content must be possible to pause, stop or hide, unless it is essential to the activity.
The example below is for the room card (.room), the dialog (.modal) and the toast (.toast). When "Reduce motion" is on, all three only fade in:
@media (prefers-reduced-motion: reduce) {
.room, .modal, .toast {
animation-name: appear; /* the movement goes... */
animation-duration: 150ms; /* ...leaving a 150 ms fade */
}
@keyframes appear { from { opacity: 0; } }
}
"Reduce motion" does not mean "turn everything off". The change of state still shows through a 150 ms fade. What goes is only the travel (the change of position).
This code only replaces animation, so two elements need their own handling:
- The
.modaldialog from lesson 2 (CSS Transitions) moves with atransition, not ananimation. So in Chromium 156 with "Reduce motion" on, the dialog still grows fromscale(0.96). Add.modal, .modal[open] { transform: none; }in the same media query, so only the opacity transition is left. - The toast from lesson 3 (CSS Keyframes) already has its own
prefers-reduced-motionblock, with the selectors.toast.showand.toast.hide. Those selectors are more specific than.toasthere, so their rules win. For the toast, use that block.
Scoring an animation with rules
In the exercise, the advice above becomes three checks in the function evaluateAnimation. props holds duration (ms), easing, distance (how far it moves, px) and hasDelay:
function evaluateAnimation(props) {
const issues = [];
if (props.duration > 500) issues.push('too slow'); // Timing: past 500 ms it drags
if (props.easing === 'linear') issues.push('use easing curve'); // Slow In and Slow Out
if (props.distance > 200) issues.push('too much movement'); // large travel, vestibular risk
return { score: 100 - issues.length * 20, issues }; // hasDelay is not scored
}
Before you look at the table below, take a guess: a room card enters in 600 ms, with linear, sliding 250 px. What is its score?
| Input | issues |
score |
|---|---|---|
300 ms, ease-out, 100 px |
[] |
100 |
600 ms, linear, 250 px |
all three | 40 |
400 ms, linear, 150 px |
["use easing curve"] |
80 |
501 ms, ease-out, 201 px |
["too slow","too much movement"] |
60 |
The 600 ms card scores 40: there are three problems, so 100 minus 3 × 20. Note the > (more than): 500 ms and 200 px do not count as problems yet, but 501 and 201 do.
⚠️ When does motion get in the way?
- Moving because you can. Movement with no feedback, orientation or continuity reason only adds waiting.
- Exits as slow as entries. Nobody is waiting for what leaves. Use 150 ms to leave and 200 ms to enter.
- Bounce on frequent interactions. A night button that bounces for 400 ms is tiring by the tenth click.
- "Reduce motion" switching off feedback. Drop the travel, but keep a 150 ms fade so the change still shows.
>=in the exercise. The rules say "more than 500" and "more than 200". If you use>=(more than or equal to), a 500 ms duration counts as a problem too.
TL;DR: Motion design is deciding why, for how long and in what order an element moves. Motion needs a reason: feedback ("your action was received"), orientation ("look here") or continuity ("this is the same thing, only moved"). The Motion page of Apple's HIG (Apple's design guide) advises "Add motion purposefully", "Make motion optional" and "Let people cancel motion". The 12 principles of animation from Frank Thomas and Ollie Johnston, Disney Animation: The Illusion of Life (1981): Squash and Stretch, Anticipation (a small movement before the main action), Staging, Straight Ahead and Pose to Pose, Follow Through and Overlapping Action, Slow In and Slow Out, Arcs, Secondary Action, Timing, Exaggeration, Solid Drawing, Appeal. Material 3 tokens (names for easing and duration values in Google's design system): easings emphasized, emphasized-decelerate, emphasized-accelerate, standard; durations short1 to short4 (50 to 200 ms), medium1 to medium4 (250 to 400 ms), long1 to long4 (450 to 600 ms). Micro-interactions (small movements on a button or a tooltip) take 100 to 300 ms; past 500 ms they feel slow (NN/g). Choreography (the order of movements and the gaps between them): one focus at a time, exits faster than entries. For people with a vestibular disorder (a problem with the balance organ), large movement can trigger dizziness and nausea. Respect prefers-reduced-motion ("Reduce motion"): a 150 ms fade, no travel. WCAG (the web accessibility guidelines) 2.3.3 (AAA): motion from interaction can be turned off. WCAG 2.2.2 (A): automatic movement over 5 seconds needs a pause. In the exercise: duration > 500 "too slow", easing === "linear" "use easing curve", distance > 200 "too much movement", score 100 minus 20 per problem.
⚡ Three reasons to move
Meaning: Motion on a web page needs a reason: feedback ("your action was received"), orientation ("look here") or continuity ("this is the same thing, only moved"). If it has none, delete the movement.
⚡ A small reaction before the main action
Guess first: of Disney's 12 principles of animation, which one adds a small movement before the main action, like a cartoon character crouching before a jump: Anticipation, Staging, or Slow In and Slow Out?
Anticipation. In UI, for example, a button shrinks first, then a dialog appears. Slow In and Slow Out (ease in and ease out) is different: it controls speeding up within one movement, not an extra movement before it.
Meaning: UI uses the subtle version of those 12 principles, not the exaggerated cartoon one.
⚡ Short and in order
Meaning: Micro-interactions (small movements that answer one action, such as on buttons and tooltips) fit in 100 to 300 ms. Past 500 ms, they feel slow. Plan the order of movements: one focus at a time, and what leaves is faster than what enters, for example 150 ms out and 200 ms in.
⚡ Reduce motion, don't switch it all off
Write:
@media (prefers-reduced-motion: reduce) {
.room, .modal, .toast {
animation-name: appear; /* the movement goes... */
animation-duration: 150ms; /* ...leaving a 150 ms fade */
}
@keyframes appear { from { opacity: 0; } }
}
Meaning: Large movement can trigger dizziness and nausea in people with a vestibular disorder (a problem with the balance organ). The rules inside this @media apply only to people who turn on "Reduce motion". The room card (.room), the dialog (.modal) and the toast (.toast) no longer change position, they only fade in over 150 ms.