liveBook · Manning

Will-change

As explained in CSS in Depth, Second Edition

The CSS will-change property provides advance information about properties expected to change on an element so the browser can optimize rendering.

Use will-change when an animation remains choppy or flickers despite normal browser optimization. It tells the browser which property is expected to change before the animation begins. section 16.3.1

Preparing a transform animation

Applying will-change: transform to an animated element can prompt the browser to place it on its own paint layer. The main layer then avoids repeated repainting while the transform changes. section 16.3.1

Use the property cautiously:

  • Do not apply it across the page before observing a performance problem. section 16.3.1
  • Test animation performance before and after adding it, and keep it only when performance improves. section 16.3.1
Figure 16.12 The three stages of the rendering pipeline
figure

Use the rendering-pipeline figure to connect animation smoothness with recalculation, painting, and layer decisions. section 16.3.1

How CSS in Depth, Second Edition covers it

How deep it goes
Explains paint-layer promotion, repaint avoidance, and resource trade-offs without detailing the full rendering implementation.
Examples
Uses animated opacity or transforms, choppy or flickering motion, and will-change: transform as examples.
What it assumes
Assumes familiarity with CSS animation, transforms or opacity, and visible animation-performance problems.
What you can do after
Diagnose/debug with it by testing whether an explicit rendering hint improves animation smoothness without unnecessary resource use.
How it connects
Connects CSS transforms, opacity, animation, GPU acceleration, paint layers, and the rendering pipeline.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.