The Rendering Pipeline
You'll learn how browsers turn your code into visible pixels through three critical stages.
What Is the Rendering Pipeline?
Every time your animation changes a CSS property, the browser must decide how much work to redo. The rendering pipeline is the sequence of steps browsers follow to display each frame:
- Layout (also called "reflow") — calculates where every element sits and how big it is
- Paint — fills in pixels for text, colors, images, borders, shadows, etc.
- Composite — layers painted elements together and sends them to the screen
How It Works
Think of building a stage play: Layout is positioning actors and props, Paint is applying makeup and costumes, and Composite is adjusting the lighting and curtains before the audience sees it.
Different CSS properties trigger different stages:
- Changing
width,height,margin, orpaddingtriggers Layout → Paint → Composite (most expensive) - Changing
color,background, orbox-shadowskips Layout but requires Paint → Composite (moderate cost) - Changing
transformoropacityonly needs Composite (cheapest, GPU-accelerated)
Why This Matters for Animations
At 60fps, you have just 16.67ms per frame. If your animation forces Layout every frame, the browser may miss the deadline, causing jank. This is why animation libraries like GSAP and Framer Motion prefer animating transform and opacity—they skip the expensive stages.
When you animate position with left/top, you're triggering Layout. When you animate with translateX/translateY, you only trigger Composite—same visual result, 10x faster.
Key Takeaway: Understanding which CSS properties trigger which pipeline stages lets you build smooth 60fps animations by avoiding Layout and Paint whenever possible.