Course contentsShow
← React
Lesson 2023 of 2,39645. AnimationsFree lesson

Trade-offs: Fidelity vs Performance

Balance rich animations with device capabilities—graceful degradation and prefers-reduced-motion media query.

Trade-offs: Fidelity vs Performance

You'll learn: How to balance beautiful animations with real-world device constraints through graceful degradation strategies.

The Fundamental Tension

Even when you follow all performance best practices—using transform and opacity, optimizing with will-change, and animating at 60fps—not all users have powerful devices. A buttery-smooth animation on your MacBook Pro might stutter on a mid-range Android phone or older laptop. The trade-off is simple: richer animations cost more computational power.

Think of it like restaurant menus: you could serve a 12-course tasting menu to everyone, but some diners want (or need) a simple, quick meal. Your animation strategy should adapt to your audience's "appetite"—or in this case, their device capabilities and preferences.

Graceful Degradation Strategies

Detect reduced motion preference: Many users enable "reduce motion" in their OS accessibility settings—for medical reasons (vestibular disorders) or personal preference. Respect this:

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

In React components, query this preference and conditionally simplify:

const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;

<motion.div
  animate={{ opacity: 1 }}
  transition={prefersReducedMotion ? { duration: 0 } : { duration: 0.5 }}
/>

Device-based scaling: On lower-end devices, reduce animation complexity—fewer particles, simpler easing, shorter durations. Use simpler CSS transitions instead of complex JavaScript timelines when performance budgets are tight.

Key Takeaway: The best animation isn't the most elaborate—it's the one that works smoothly for all your users. Always provide escape hatches via prefers-reduced-motion and consider device-appropriate animation complexity.