Key insight: Apple uses animation to tell stories, not just decorate. Each motion has meaning.
Gradient Animation
Subtle, continuous motion
Principles Identified:
SubtletySlow, gentle gradient shifts
BrandSignature animated gradients
PerformanceCSS-only, no JavaScript
Key insight: Stripe's animations are so subtle you barely notice them, yet they make the site feel alive.
Micro-interactions
Every click has feedback
Principles Identified:
FeedbackButton presses, checkmarks, transitions
Speed100-200ms for instant feel
ConsistencySame easing throughout
Key insight: Linear's UI feels incredibly responsive because every interaction has immediate animated feedback.
Part E
Common Failures
12
Animation Anti-Patterns
Common mistakes that hurt user experience.
Failure: Too Slow
transition: 1.5s
User waits... and waits...
Fix: Keep transitions under 400ms
transition: 0.2s
Snappy and responsive
Rule: 200-300ms for most UI. 400ms max for complex transitions. Slower animations frustrate users.
Failure: Animating Layout
width: 100px → 200px
Triggers reflow, janky at 60fps
Fix: Only animate transform and opacity
transform: scaleX(2)
GPU-accelerated, smooth
Rule: Never animate width, height, top, left, margin, or padding. Use transform instead.
Failure: No Motion Preference
Animations everywhere
Vestibular disorders triggered
Fix: Respect prefers-reduced-motion
@media (prefers-reduced-motion) {
* { animation: none; }
}
Rule: Always provide reduced-motion alternatives. Some users experience nausea or seizures from animation.
Failure: Infinite Loops
🔄 Spinning forever
Distracting, drains battery
Fix: Limit continuous animation
Load → Spin → Stop
Animation has purpose and end
Rule: Infinite animations should be subtle or have clear purpose (loading). Stop animations when not needed.
Test
Enable prefers-reduced-motion in your OS and test your site. Does it still work? Is it still usable?
Part F
Visual Tests
13
Animation Testing
How to ensure animations are performant and accessible.
01
60fps Test
Tests: Performance
Open DevTools Performance tab. Record while triggering animations. Look for dropped frames (red). Target: solid 60fps green bars.
Red = dropped frame
02
Paint Flash
Tests: Repaints
DevTools → More tools → Rendering → Paint flashing. Green flashes show repaints. Animations should NOT cause large green areas - only the animated element.
Only animated element should flash
03
Reduced Motion
Tests: Accessibility
Enable reduced motion in OS settings. Reload your site. All animations should be disabled or significantly reduced. Essential functionality must still work.
System Preferences → Accessibility
→ Display → Reduce motion
04
Battery Test
Tests: Efficiency
Check CPU/GPU usage during animations. Continuous animations should use minimal resources. Test on mobile devices where battery matters most.
Tip: Always include reduced-motion styles. It's not optional - it's accessibility.
Checklist
Only animate transform/opacity, use ease-out for entrances, respect prefers-reduced-motion, keep under 400ms.
Part H
Self-Assessment
15
Self-Assessment
Test your understanding of animation principles.
Q1
Why should you only animate transform and opacity?
Click to reveal
Answer: They're the only properties that only trigger the Composite step of the rendering pipeline. Other properties (width, height, margin) trigger Layout or Paint, which are expensive and cause jank at 60fps.
Q2
What timing function should you use for elements entering the screen?
Click to reveal
Answer: ease-out. Elements entering should decelerate as they arrive at their destination, mimicking natural physics where objects slow down due to friction.
Q3
What is the ideal duration range for UI transitions?
Click to reveal
Answer: 200-300ms for most interactions. Under 100ms feels instant, 300-400ms for complex transitions. Over 500ms feels slow and frustrating.
Q4
How do you respect users who prefer reduced motion?
Click to reveal
Answer: Use the prefers-reduced-motion media query to disable or significantly reduce animations. Some users have vestibular disorders where motion causes nausea or worse.
Q5
What's the difference between transitions and keyframe animations?
Click to reveal
Answer: Transitions animate between two states (A → B) and are triggered by state changes. Keyframes can have unlimited steps (0% → 50% → 100%) and can loop infinitely.