Why Does One Animation Run Smooth and Another Stutter?
Two animations can look identical in a screenshot and behave nothing alike on a mid-range phone. One glides. The other drops frames the moment anything else on the page wakes up. The difference is rarely the easing curve or the duration. It's which part of the browser's frame pipeline each animated property drags into the work.
That's the whole subject of this article, and the demo above is the smallest honest version of it. Three bars grow by the same amount. One animates width, one animates transform: scaleX(), one animates clip-path. They look similar on a fast laptop and they cost completely different things per frame. Open the preview, break it, and keep that picture in your head for the rest of the page.
I'm not going to quote frame rates here. A number from my machine tells you nothing about yours, and the browser won't give you a stable one anyway. What I can give you is the mechanism, a ranking of properties you can verify yourself, a handful of patterns, and the exact steps to check any animation in Chrome DevTools in about two minutes.
What Does the Browser Do for Every Single Frame?
Four stages, in order. Style works out which rules apply to which element. Layout works out how big everything is and where it goes. Paint draws pixels into layers. Composite stacks those layers together on screen.
Here's the part that matters. A change early in that list forces everything after it. Animate width and the browser has to redo layout, then paint, then composite, sixty times a second. Animate a colour and it skips layout but still repaints. Animate transform or opacity on an element that already has its own layer and the browser can often do nothing except composite. That's why every performance guide you've ever read ends with the same two words.
The budget is tight. A frame at 60Hz lasts about 16.6ms, and at 120Hz it lasts about 8.3ms. The browser needs part of that for its own housekeeping, so web.dev's rendering guidance suggests planning for roughly 10ms of your own work at 60Hz. If your animation fits inside it, nobody notices. If it doesn't, they see a stutter and blame your design.
One more thing before the table. Compositor-driven animations keep running even when the main thread is busy, which is a real advantage for CSS animations over most JavaScript-driven ones. If you want the long version of that trade, blocking the main thread covers the budget from the other side.
Which Properties Are Cheap to Animate?
Rank them by the earliest stage they trigger:
| Property | Earliest stage triggered | Verdict |
|---|---|---|
width, height, top, left, margin, padding, font-size | Layout | Avoid on anything large |
box-shadow, background-color, color, border-radius | Paint | Fine in small doses, costly across big areas |
clip-path | Paint (no layout change) | Good for reveals, check it on target devices |
transform (also translate, scale, rotate) | Composite | Default choice |
opacity | Composite | Default choice |
Two notes on that table. First, filter and backdrop-filter can also run on the compositor in Chromium, but a large blur radius makes each frame expensive in its own way, so "composited" doesn't mean "free". Second, the individual translate, scale and rotate properties behave like their transform cousins, and they let you animate one axis without rewriting the whole transform string. I reach for them whenever a hover state and an entrance animation would otherwise fight over the same transform.
Is the table gospel? No. Browsers change, and a layout animation on a tiny, isolated element can cost less than a badly layered composite one. Treat it as a ranking of where to look first, not a ban list.
Five Patterns That Stay on the Cheap Side
These are the declarations I'd start from. Each one gets the same visual result as the expensive version.
Slide with translate, not left
.drawer {
transform: translateX(-100%);
transition: transform 300ms cubic-bezier(.22, 1, .36, 1);
}
.drawer.is-open {
transform: translateX(0);
}
Same distance, no layout. The element still occupies its original box in the flow, which is usually what you want for an overlay. If it isn't, you're animating the wrong thing and the fix is design, not CSS.
Enter with opacity and a short rise
.card {
animation: enter 600ms cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes enter {
from { opacity: 0; transform: translateY(24px); }
to { opacity: 1; transform: translateY(0); }
}
Both properties are compositor-friendly, so a whole grid of these costs little. For lists, spread the start times with a delay step rather than writing one rule per item; the stagger calculator works out that step from the item count and your deadline, and the stagger teardown shows where the delays go wrong.
Lift a card without animating box-shadow
Animating box-shadow repaints the area around the element every frame. The classic workaround puts the finished shadow on a pseudo-element and fades only that:
.tile { position: relative; transition: transform 200ms ease-out; }
.tile::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
box-shadow: 0 18px 32px rgb(20 20 40 / .28);
opacity: 0;
transition: opacity 200ms ease-out;
pointer-events: none;
}
.tile:hover { transform: translateY(-4px); }
.tile:hover::after { opacity: 1; }
The shadow is painted once. After that, the browser only changes its opacity. I think this is the most underused trick in everyday UI work, mostly because the shadow-on-hover one-liner is so easy to type.
Grow with clip-path or transform, and know what each costs
This is the demo at the top. transform: scaleX() is cheap but it squashes everything inside, including text and round shapes. width keeps the content intact but forces layout. clip-path: inset() keeps the content intact and doesn't change layout, because it only changes what's visible. The trade is that the element's box doesn't change either, so surrounding content won't move to fill the gap.
When you need the surroundings to move too, you need layout. In that case animate the smallest subtree you can, and accept the cost on purpose.
Press feedback with scale
.button:active { transform: scale(.97); }
.button { transition: transform 120ms ease-out; }
Tiny, instant, composited. Pair it with a colour change that doesn't animate if you want the pressed state to feel solid, and keep the duration short. Longer than about 150ms and a press starts to feel like lag.
When Should You Reach for will-change?
Less often than you think. The will-change property tells the browser that a property is about to change, so it can set up a layer ahead of time instead of mid-animation. That helps when you see a visible hitch on the first frame. It hurts when you sprinkle it everywhere, because each promoted layer takes memory and the browser has more compositing to manage.
Three rules cover most cases:
- Apply it to the one or two elements about to move, not to a class used by fifty cards.
- Add it shortly before the motion (on
:hoverof the parent, say) and remove it when the motion ends. - Remember the side effect:
will-change: transformcreates a new stacking context and changes how fixed and absolute descendants are positioned. A dropdown that suddenly clips or moves after you "optimised" its parent is the usual symptom.
My opinion, and you can disagree: if an animation needs will-change to look smooth, the animation is probably doing too much per frame, and the hint is hiding a bigger problem. Fix the properties first. Use the hint last.
If an animation needs will-change to look smooth, it is probably doing too much per frame, and the hint is hiding the real problem.
How Do You Prove an Animation Is Cheap?
Don't trust the mechanism. Look at it. Chrome DevTools gives you three tools that take a few minutes to learn and answer the question directly.
- Paint flashing. Open the Rendering drawer and switch on paint flashing. Regions that repaint flash green. A compositor-only animation shouldn't flash at all. If your sliding drawer paints on every frame, something besides
transformis changing. - Layer borders. The same drawer can outline compositor layers. This shows you which elements got promoted, and it's how you spot a page with far too many of them.
- The Performance panel. Record a few seconds while the animation runs, then read the main-thread track. Look for repeated
Recalculate Style,LayoutandPaintentries lined up with each frame. Pure compositor animations leave that track almost quiet. Then turn on CPU throttling in the panel's settings and record again, because a slow device is where a marginal animation falls apart.
Do the throttled recording before you ship, not after a user complains. A frame that fits on your laptop with room to spare can miss its deadline on a phone with a quarter of the CPU, and the panel will show you exactly which stage ate the time.
If the animation passes all three, you're done. If it doesn't, the track tells you which stage to go after, and the table above tells you what to swap.
Where Do Good Animations Quietly Go Wrong?
Most regressions don't come from the animation itself. They come from something added next to it six months later. A few I'd check first when a smooth motion starts to hitch.
Animating a property that was never cheap, because a library said so. Some component libraries animate height to open an accordion. It works, it looks fine on a developer laptop, and it triggers layout for the panel and everything below it on every frame. If the panel is small and the page is simple, shrug. If the page holds a long article below it, you've signed up for layout work on hundreds of nodes.
Transitioning all. transition: all 300ms feels harmless until somebody adds a box-shadow or a background change to the hover state. Now two properties you never meant to animate are animating, and one of them repaints a large area. Name the properties. It's a few extra characters and it makes the cost visible in the stylesheet.
Layers you didn't ask for. Overlapping a composited element can force the browser to promote the elements stacked above it, so a single animated header can quietly turn a dozen siblings into layers. Layer borders in DevTools will show it. The fix is usually a cleaner stacking order, not a different property.
Big blurs and big images. A composited filter: blur() is still arithmetic on every pixel. A hero image that's four times larger than it displays makes that arithmetic four times worse. Resize the asset first, then worry about the effect.
Ignoring the first frame. An animation that starts by loading an image, a font or a script will stall exactly when the reader is watching. Preload what the first frame needs, or start the motion after it's ready. A smooth curve can't rescue a stalled start.
None of these needs a rewrite. Each one needs somebody to open the Performance panel once and look, which is the whole argument of this article in one sentence.
What About Easing, Scroll and Reduced Motion?
Easing doesn't change the cost per frame. It changes how the motion feels, which is a separate argument that the easing curves guide already makes properly. A well-chosen curve on a cheap property beats a clever curve on an expensive one, though, so decide the property first and the curve second.
Scroll-driven animations follow the same rules. The timeline is new; the pipeline isn't. Drive transform and opacity from a scroll timeline and you get the same cheap path, as covered in scroll-driven animation timing patterns. Drive width from it and you've built a layout loop on every scroll tick. Scroll timelines are one of the motion graphics trends everyone's chasing this year, which is one more reason to settle the property choice first.
Reduced motion deserves its own sentence in any performance article, because the two topics get confused. prefers-reduced-motion isn't a performance setting. It's an accessibility setting for people who find movement disorienting. The right response is usually to keep the feedback and drop the travel, a fade in place of a slide, rather than to switch animation off. Reduce motion, not emotion lays out four ways to answer it. And if a user taps a button and nothing visibly responds, you've failed them in a different way.
So the order of work looks like this. Pick the cheapest property that gives the effect. Add a reduced-motion version that keeps the signal. Then check the result with paint flashing and one throttled recording. That's the entire routine, and it fits in the time it takes to reload the page twice.
See both settings at once
Cheaper motion and calmer motion usually come from the same edit: fewer moving parts per frame. The panel below is seeded with the slide-and-fade entrance from the patterns above. Run it under both settings and check what the reduce side keeps, because an entrance that only fades still tells the reader something arrived.