Tasteful Web Animation
This skill implements refined, purposeful animations inspired by Emil Kowalski's work and the principles from animations.dev. The goal is motion that feels inevitable and natural - not decorative or attention-seeking.
In this codebase, prefer importing Motion from motion/react (same component API as classic Framer Motion).
Core Philosophy
Animation should be invisible. When done right, users don't notice animation - they notice that the interface feels good. The moment someone says "nice animation," you've probably overdone it.
"The best animations are the ones you don't notice." — Emil Kowalski
The 40 Rules of Tasteful Animation
Timing & Duration
Micro-interactions: 150-250ms. Hovers, button presses, toggles. Anything faster feels instant (good); anything slower feels sluggish (bad).
Standard transitions: 200-350ms. Modals opening, panels sliding, content appearing. This is your bread and butter.
Complex orchestrations: 400-600ms total. Page transitions, multi-step reveals. Never longer unless you have a very good reason.
Exit animations should be faster than entrances. Users are waiting to do something next. Enter at 300ms, exit at 200ms.
Stagger delays: 30-60ms between items. Longer staggers (100ms+) feel like a slideshow. Keep it tight.
Never animate for more than 1 second total. If your animation takes longer, it's not an animation - it's a loading screen.
Easing & Physics
Default to ease-out for entrances. Elements arriving should decelerate naturally, like a car pulling into a parking spot.
Use ease-in for exits. Elements leaving should accelerate away, like releasing a bowstring.
Use ease-in-out sparingly. Only for elements that move from point A to point B while staying on screen (dragging, repositioning).
Never use linear easing for UI. Linear is for progress bars and looping background animations only. Real objects don't move linearly.
Prefer spring physics for organic motion. Springs have natural overshoot and settle. Use spring configs in Motion (e.g. type: "spring", stiffness, damping) or CSS linear() / cubic-bezier approximations.
Match easing to physical metaphor. Dropping? Ease-in with bounce. Rising? Ease-out. Sliding? Ease-in-out.
Consistent easing across related elements. If a modal and its backdrop animate together, they must use the same curve.
What to Animate
Animate transform and opacity only (when possible). These are GPU-accelerated and won't cause layout thrashing.
Never animate width, height, top, left, margin, or padding. These trigger expensive layout recalculations. Use transform: scale() or translate() instead.
Animate from a definite state to a definite state. Never animate to/from auto or computed values without measuring first.
Scale from center for growth, from origin for menus. Dropdowns scale from their trigger. Modals scale from center. Be intentional.
Opacity changes should accompany movement. Don't just fade - fade AND move. opacity: 0 + translateY(8px) → opacity: 1 + translateY(0).
Keep movement distances small. 4-16px for micro-interactions. 20-40px for larger reveals. Anything more looks cartoony.
Interaction States
Hover: instant on, 150ms off. Respond immediately when hovering; ease out when leaving so it doesn't "snap" away.
Active/pressed: scale(0.97-0.98). Subtle compression. Never go below 0.95 - that's cartoon territory.
Focus: never animate the focus ring itself. Focus indicators are for accessibility. Animate the element, not the indicator.
Disabled elements: no animation. Disabled means disabled. Don't tease users with hover effects on things they can't click.
Loading states: subtle pulse or skeleton shimmer. Not spinners unless absolutely necessary. Keep the rhythm calm.
Entrance & Exit Patterns
Fade + rise for content appearing. opacity: 0, y: 8 → opacity: 1, y: 0. The classic for a reason.
Fade + sink for content disappearing. Reverse is not always best. Sometimes exit down, not up, for natural gravity.
Scale for emphasis, translate for navigation. Opening something important? Scale. Moving to a new view? Slide.
Modals: scale(0.96) + opacity, not scale(0). Starting from nothing looks cheap. Start nearly there.
Toasts: slide from edge + fade. Come from where they'll return to. Slide in from right, slide out to right.
Menus: transform-origin at trigger, scale + opacity. Dropdowns should bloom from their source.
Orchestration & Staggering
Lead with the most important element. In a stagger sequence, the primary content animates first.
Background elements animate first, foreground last. Backdrop → container → content → actions.
Use stagger for related items only. A list of cards? Stagger. Unrelated UI elements? Animate together.
Keep stagger groups small (3-7 items). More than that and the last item waits too long.
Exit in reverse order or all-at-once. Either mirror the entrance stagger (last in, first out) or don't stagger exits at all.
Performance & Accessibility
Always respect prefers-reduced-motion. Not optional. Wrap motion in @media (prefers-reduced-motion: no-preference) or check the query in JS.
Use will-change only when needed, remove after. Apply before animation starts, remove after it ends. Never leave it on permanently.
Avoid animating during scroll. Scroll-linked animations can jank. Use scroll-timeline or Intersection Observer sparingly.
Test on low-end devices. That buttery M3 Mac animation becomes a slideshow on a $200 Android.
Don't animate layout on mobile. Mobile browsers struggle with layout animations. Keep it to transforms and opacity.
CSS Implementation Patterns
Standard Transition Setup
.element {
transition: transform 200ms ease-out, opacity 200ms ease-out;
}
/* Hover: instant on, fade off */
.element:hover {
transform: translateY(-2px);
transition-duration: 0ms; /* instant on */
}
.element:not(:hover) {
transition-duration: 150ms; /* ease off */
}
Fade + Rise Entrance
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.entering {
animation: fadeInUp 250ms ease-out forwards;
}
Spring-like Easing (CSS)
/* Approximated spring curve */
:root {
--spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
--spring-smooth: cubic-bezier(0.22, 1, 0.36, 1);
--spring-snappy: cubic-bezier(0.16, 1, 0.3, 1);
}
Stagger Pattern
.item { animation: fadeInUp 200ms ease-out backwards; }
.item:nth-child(1) { animation-delay: 0ms; }
.item:nth-child(2) { animation-delay: 40ms; }
.item:nth-child(3) { animation-delay: 80ms; }
.item:nth-child(4) { animation-delay: 120ms; }
.item:nth-child(5) { animation-delay: 160ms; }
Reduced Motion
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
Motion (motion/react) Patterns
Fade + Rise
<motion.div
initial={{ opacity: 0, y: 8 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 4 }}
transition={{ duration: 0.2, ease: [0.22, 1, 0.36, 1] }}
/>
Spring Physics
<motion.div
animate={{ scale: 1 }}
whileTap={{ scale: 0.97 }}
transition={{ type: "spring", stiffness: 400, damping: 25 }}
/>
Stagger Children
<motion.ul
initial="hidden"
animate="visible"
variants={{
visible: { transition: { staggerChildren: 0.04 } },
}}
>
{items.map(item => (
<motion.li
key={item.id}
variants={{
hidden: { opacity: 0, y: 8 },
visible: { opacity: 1, y: 0 },
}}
/>
))}
</motion.ul>
Exit Before Enter (AnimatePresence)
<AnimatePresence mode="wait">
<motion.div
key={currentView}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
/>
</AnimatePresence>
Common Mistakes to Avoid
- Bouncy everything. Bounce is for celebration (confetti, success). Not for opening menus.
- Slow fades. If opacity takes more than 200ms, it feels like lag, not elegance.
- Scale(0) to scale(1). Looks like things popping into existence from nothing. Start at 0.95+.
- Inconsistent directions. If modals enter from bottom, they exit to bottom. Pick a direction and commit.
- Animating on mount unconditionally. First page load? Maybe. Every re-render? Definitely not.
- Forgetting exit animations. Things snapping away is jarring. Every entrance needs an exit strategy.
- Using animation to hide slow code. If you're animating to mask loading, fix the loading instead.
- Too many things moving at once. One focal animation, everything else is secondary or static.
When NOT to Animate
- Form validation errors (use color/icon changes instead)
- Critical error states (don't delay bad news)
- Content the user is actively reading
- High-frequency updates (live data, timers)
- Anything the user will see hundreds of times per session
Testing Checklist
"Animation is not about moving things. It's about not making users wait." — Emil Kowalski
1---2name: anim-33description: Tasteful, subtle web animations following Emil Kowalski's philosophy and animations.dev principles. Use this skill when adding motion to interfaces - hover states, page transitions, micro-interactions, loading states, or any UI animation. Produces refined, purposeful motion that enhances UX without becoming decorative noise.4---56# Tasteful Web Animation78This skill implements refined, purposeful animations inspired by Emil Kowalski's work and the principles from animations.dev. The goal is motion that feels inevitable and natural - not decorative or attention-seeking.910In this codebase, prefer importing Motion from `motion/react` (same component API as classic Framer Motion).1112## Core Philosophy1314**Animation should be invisible.** When done right, users don't notice animation - they notice that the interface feels *good*. The moment someone says "nice animation," you've probably overdone it.1516> "The best animations are the ones you don't notice." — Emil Kowalski1718## The 40 Rules of Tasteful Animation1920### Timing & Duration21221. **Micro-interactions: 150-250ms.** Hovers, button presses, toggles. Anything faster feels instant (good); anything slower feels sluggish (bad).23242. **Standard transitions: 200-350ms.** Modals opening, panels sliding, content appearing. This is your bread and butter.25263. **Complex orchestrations: 400-600ms total.** Page transitions, multi-step reveals. Never longer unless you have a very good reason.27284. **Exit animations should be faster than entrances.** Users are waiting to do something next. Enter at 300ms, exit at 200ms.29305. **Stagger delays: 30-60ms between items.** Longer staggers (100ms+) feel like a slideshow. Keep it tight.31326. **Never animate for more than 1 second total.** If your animation takes longer, it's not an animation - it's a loading screen.3334### Easing & Physics35367. **Default to ease-out for entrances.** Elements arriving should decelerate naturally, like a car pulling into a parking spot.37388. **Use ease-in for exits.** Elements leaving should accelerate away, like releasing a bowstring.39409. **Use ease-in-out sparingly.** Only for elements that move from point A to point B while staying on screen (dragging, repositioning).414210. **Never use linear easing for UI.** Linear is for progress bars and looping background animations only. Real objects don't move linearly.434411. **Prefer spring physics for organic motion.** Springs have natural overshoot and settle. Use spring configs in Motion (e.g. `type: "spring", stiffness, damping`) or CSS `linear()` / cubic-bezier approximations.454612. **Match easing to physical metaphor.** Dropping? Ease-in with bounce. Rising? Ease-out. Sliding? Ease-in-out.474813. **Consistent easing across related elements.** If a modal and its backdrop animate together, they must use the same curve.4950### What to Animate515214. **Animate transform and opacity only (when possible).** These are GPU-accelerated and won't cause layout thrashing.535415. **Never animate width, height, top, left, margin, or padding.** These trigger expensive layout recalculations. Use transform: scale() or translate() instead.555616. **Animate from a definite state to a definite state.** Never animate to/from `auto` or computed values without measuring first.575817. **Scale from center for growth, from origin for menus.** Dropdowns scale from their trigger. Modals scale from center. Be intentional.596018. **Opacity changes should accompany movement.** Don't just fade - fade AND move. `opacity: 0` + `translateY(8px)` → `opacity: 1` + `translateY(0)`.616219. **Keep movement distances small.** 4-16px for micro-interactions. 20-40px for larger reveals. Anything more looks cartoony.6364### Interaction States656620. **Hover: instant on, 150ms off.** Respond immediately when hovering; ease out when leaving so it doesn't "snap" away.676821. **Active/pressed: scale(0.97-0.98).** Subtle compression. Never go below 0.95 - that's cartoon territory.697022. **Focus: never animate the focus ring itself.** Focus indicators are for accessibility. Animate the element, not the indicator.717223. **Disabled elements: no animation.** Disabled means disabled. Don't tease users with hover effects on things they can't click.737424. **Loading states: subtle pulse or skeleton shimmer.** Not spinners unless absolutely necessary. Keep the rhythm calm.7576### Entrance & Exit Patterns777825. **Fade + rise for content appearing.** `opacity: 0, y: 8` → `opacity: 1, y: 0`. The classic for a reason.798026. **Fade + sink for content disappearing.** Reverse is not always best. Sometimes exit down, not up, for natural gravity.818227. **Scale for emphasis, translate for navigation.** Opening something important? Scale. Moving to a new view? Slide.838428. **Modals: scale(0.96) + opacity, not scale(0).** Starting from nothing looks cheap. Start nearly there.858629. **Toasts: slide from edge + fade.** Come from where they'll return to. Slide in from right, slide out to right.878830. **Menus: transform-origin at trigger, scale + opacity.** Dropdowns should bloom from their source.8990### Orchestration & Staggering919231. **Lead with the most important element.** In a stagger sequence, the primary content animates first.939432. **Background elements animate first, foreground last.** Backdrop → container → content → actions.959633. **Use stagger for related items only.** A list of cards? Stagger. Unrelated UI elements? Animate together.979834. **Keep stagger groups small (3-7 items).** More than that and the last item waits too long.9910035. **Exit in reverse order or all-at-once.** Either mirror the entrance stagger (last in, first out) or don't stagger exits at all.101102### Performance & Accessibility10310436. **Always respect `prefers-reduced-motion`.** Not optional. Wrap motion in `@media (prefers-reduced-motion: no-preference)` or check the query in JS.10510637. **Use `will-change` only when needed, remove after.** Apply before animation starts, remove after it ends. Never leave it on permanently.10710838. **Avoid animating during scroll.** Scroll-linked animations can jank. Use `scroll-timeline` or Intersection Observer sparingly.10911039. **Test on low-end devices.** That buttery M3 Mac animation becomes a slideshow on a $200 Android.11111240. **Don't animate layout on mobile.** Mobile browsers struggle with layout animations. Keep it to transforms and opacity.113114## CSS Implementation Patterns115116### Standard Transition Setup117118```css119.element {120 transition: transform 200ms ease-out, opacity 200ms ease-out;121}122123/* Hover: instant on, fade off */124.element:hover {125 transform: translateY(-2px);126 transition-duration: 0ms; /* instant on */127}128.element:not(:hover) {129 transition-duration: 150ms; /* ease off */130}131```132133### Fade + Rise Entrance134135```css136@keyframes fadeInUp {137 from {138 opacity: 0;139 transform: translateY(8px);140 }141 to {142 opacity: 1;143 transform: translateY(0);144 }145}146147.entering {148 animation: fadeInUp 250ms ease-out forwards;149}150```151152### Spring-like Easing (CSS)153154```css155/* Approximated spring curve */156:root {157 --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);158 --spring-smooth: cubic-bezier(0.22, 1, 0.36, 1);159 --spring-snappy: cubic-bezier(0.16, 1, 0.3, 1);160}161```162163### Stagger Pattern164165```css166.item { animation: fadeInUp 200ms ease-out backwards; }167.item:nth-child(1) { animation-delay: 0ms; }168.item:nth-child(2) { animation-delay: 40ms; }169.item:nth-child(3) { animation-delay: 80ms; }170.item:nth-child(4) { animation-delay: 120ms; }171.item:nth-child(5) { animation-delay: 160ms; }172```173174### Reduced Motion175176```css177@media (prefers-reduced-motion: reduce) {178 *, *::before, *::after {179 animation-duration: 0.01ms !important;180 animation-iteration-count: 1 !important;181 transition-duration: 0.01ms !important;182 }183}184```185186## Motion (`motion/react`) Patterns187188### Fade + Rise189190```tsx191<motion.div192 initial={{ opacity: 0, y: 8 }}193 animate={{ opacity: 1, y: 0 }}194 exit={{ opacity: 0, y: 4 }}195 transition={{ duration: 0.2, ease: [0.22, 1, 0.36, 1] }}196/>197```198199### Spring Physics200201```tsx202<motion.div203 animate={{ scale: 1 }}204 whileTap={{ scale: 0.97 }}205 transition={{ type: "spring", stiffness: 400, damping: 25 }}206/>207```208209### Stagger Children210211```tsx212<motion.ul213 initial="hidden"214 animate="visible"215 variants={{216 visible: { transition: { staggerChildren: 0.04 } },217 }}218>219 {items.map(item => (220 <motion.li221 key={item.id}222 variants={{223 hidden: { opacity: 0, y: 8 },224 visible: { opacity: 1, y: 0 },225 }}226 />227 ))}228</motion.ul>229```230231### Exit Before Enter (AnimatePresence)232233```tsx234<AnimatePresence mode="wait">235 <motion.div236 key={currentView}237 initial={{ opacity: 0 }}238 animate={{ opacity: 1 }}239 exit={{ opacity: 0 }}240 transition={{ duration: 0.15 }}241 />242</AnimatePresence>243```244245## Common Mistakes to Avoid246247- **Bouncy everything.** Bounce is for celebration (confetti, success). Not for opening menus.248- **Slow fades.** If opacity takes more than 200ms, it feels like lag, not elegance.249- **Scale(0) to scale(1).** Looks like things popping into existence from nothing. Start at 0.95+.250- **Inconsistent directions.** If modals enter from bottom, they exit to bottom. Pick a direction and commit.251- **Animating on mount unconditionally.** First page load? Maybe. Every re-render? Definitely not.252- **Forgetting exit animations.** Things snapping away is jarring. Every entrance needs an exit strategy.253- **Using animation to hide slow code.** If you're animating to mask loading, fix the loading instead.254- **Too many things moving at once.** One focal animation, everything else is secondary or static.255256## When NOT to Animate257258- Form validation errors (use color/icon changes instead)259- Critical error states (don't delay bad news)260- Content the user is actively reading261- High-frequency updates (live data, timers)262- Anything the user will see hundreds of times per session263264## Testing Checklist265266- [ ] Does it feel good at 2x speed? (If not, it's too slow)267- [ ] Does it feel good at 0.5x speed? (If not, it's too fast or lacks easing)268- [ ] Does it work with reduced motion enabled?269- [ ] Does the exit feel as considered as the entrance?270- [ ] Would a user notice if you removed it? (If yes, reconsider)271- [ ] Does it work on a $200 Android phone?272273---274275*"Animation is not about moving things. It's about not making users wait."* — Emil Kowalski