Understanding the 60fps Target
You'll learn why 60 frames per second is the gold standard for web animations and how browsers budget time for each frame.
Why 60fps Matters
Most modern displays refresh 60 times per second (60Hz). To create smooth, jank-free animations, your browser must prepare a new frame every time the screen refreshes. If a frame isn't ready in time, the browser shows the previous frame again—creating a visible stutter or "jank."
60fps means delivering a fresh frame every 16.67 milliseconds (1000ms ÷ 60 ≈ 16.67ms). This is your frame budget—the maximum time you have to compute and render each frame.
The Frame Budget Breakdown
Within those ~16ms, the browser must complete several tasks:
- JavaScript execution (your animation code, event handlers)
- Style calculations (applying CSS changes)
- Layout (positioning elements)
- Paint (drawing pixels)
- Composite (layering and final screen output)
In reality, the browser needs overhead time, so you effectively have ~10-12ms for your JavaScript and rendering work. If any frame takes longer than 16.67ms, you drop below 60fps.
Why This Matters for Animations
When choosing between CSS animations and JavaScript libraries, understanding frame budgets is crucial. CSS animations often run on the compositor thread, bypassing some of those costly steps. Libraries like GSAP optimize by batching DOM changes and using requestAnimationFrame, but they still compete for that precious 16ms window.
Key Takeaway: 60fps requires delivering a complete frame every 16.67ms; exceeding this budget causes janky animations, making frame-budget awareness essential for choosing and optimizing animation techniques.