Back to Insights
Performance

Animation Performance: 60fps on Any Device

February 22, 2025
10 min
Animation Performance: 60fps on Any Device

Smooth animations make interfaces feel responsive and premium. Janky animations make them feel broken and cheap. The difference is performance. At 60fps, you have just 16.67ms per frame. Miss that budget and you get jank. Let's learn how to create buttery-smooth animations that work on any device.

The Rendering Pipeline

Understanding how browsers render frames is essential for performance optimization.

Layout, Paint, and Composite

The browser rendering pipeline has three main stages. Layout calculates element positions and sizes. Paint fills in pixels (text, colors, images). Composite combines layers. Changing layout properties (width, height, position) triggers all three stages—expensive. Changing paint properties (color, background) triggers paint and composite—less expensive. Changing composite properties (transform, opacity) only triggers composite—cheap and fast.

GPU Acceleration

The GPU is designed for graphics operations. By moving work to the GPU, you free up the CPU and get better performance. Transform and opacity are GPU-accelerated. Use transform: translateX() instead of left. Use transform: scale() instead of width/height. Use opacity instead of visibility when animating. These properties are composited on the GPU, bypassing layout and paint.

The FLIP Technique

FLIP (First, Last, Invert, Play) is a technique for animating expensive layout changes cheaply.

How FLIP Works

First: record the initial position. Last: apply the final state and record the new position. Invert: use transform to move the element back to its initial position. Play: remove the transform and animate. This lets you animate layout changes using only transform, which is GPU-accelerated. Libraries like Framer Motion use FLIP internally.

When to Use FLIP

Use FLIP for animating between states that involve layout changes: reordering lists, expanding cards, moving elements between containers. It's especially powerful for shared element transitions. The technique is complex to implement manually, so consider using a library like Framer Motion or React Spring that handles it for you.

Optimization Techniques

Specific techniques for maximizing animation performance.

The will-change Property

will-change tells the browser which properties will animate, allowing it to optimize ahead of time. Use it sparingly—it consumes memory. Apply it just before animation starts and remove it after. Don't apply it to too many elements. Good: will-change: transform on a single animating element. Bad: will-change: transform on every element in a list.

Reduce Paint Area

Smaller paint areas mean faster paints. Use contain: layout paint to isolate elements. This tells the browser that changes inside the element won't affect anything outside. Use overflow: hidden to prevent paint from extending beyond element bounds. These optimizations help the browser skip unnecessary work.

Debounce and Throttle

For animations triggered by scroll or resize, use throttling to limit how often they run. For animations triggered by user input, use debouncing to wait until input stops. This reduces the number of frames you need to render. Use requestAnimationFrame for smooth, synchronized updates.

Key Takeaways

Smooth animations require understanding the rendering pipeline and using GPU-accelerated properties. Animate transform and opacity. Use FLIP for layout changes. Apply will-change judiciously. Reduce paint areas with containment. The result is animations that run at 60fps on any device, making your interface feel fast, responsive, and premium.

Ready to transform your digital presence?

Let's discuss how strategic design and development can elevate your business.