Performance Budget for Animations
You'll learn how to set performance targets for animations and when to simplify or disable them on less powerful devices.
What Is a Performance Budget?
A performance budget is a set of limits you impose on your animations to ensure they run smoothly. Think of it like a speed limit for your website's graphics—you're deciding what's "fast enough" and staying within those bounds.
The 60fps Target
The gold standard for smooth animations is 60 frames per second (fps). This means the browser redraws the screen every ~16.67 milliseconds. When animations drop below 60fps, users perceive stuttering or jank.
Setting a 60fps target means:
- Each frame must complete in under 16ms
- Use composite-only properties (
transform,opacity) - Monitor with browser DevTools Performance panel
- Test on mid-range and low-end devices, not just your development machine
When to Simplify or Disable
Not all devices can maintain 60fps with complex animations. You should:
Simplify animations when:
- Multiple animations run simultaneously
- Devices show frame drops in testing
- Reducing animation complexity maintains user experience
Disable animations when:
- The device can't maintain 30fps minimum
- User has enabled
prefers-reduced-motion - Battery is critically low (via JavaScript Battery API)
You can use media queries or JavaScript feature detection to adjust animation complexity based on device capabilities.
Key Takeaway: A performance budget means targeting 60fps for animations and being willing to simplify or disable them when devices can't maintain smooth playback—prioritize user experience over visual flair.