Skip to content
Engineering

Building performant scroll animations

Keep scroll motion on the compositor—and test it on a phone that is not yours

February 3, 2025
By Manweba

Janky motion is worse than none. Users feel dropped frames before they notice your easing curve. The craft is knowing which properties stay on the GPU and how to schedule work.

Animate transform and opacity

Layout-affecting properties (width, height, top, margin) force style → layout → paint every frame. Transform and opacity can often stay on the compositor.

Same visual move, different cost: prefer translate over left.

Compositor-friendly vs layout thrash

jsx
Loading code…

useScroll + useTransform

Motion’s scroll hooks give you normalized progress without hand-rolled listeners. Map that progress to the few properties that matter; do not animate everything “because we can.”

Element-scoped scroll mapping

jsx
Loading code…

Viewport triggers via Intersection Observer

whileInView (Intersection Observer under the hood) beats scroll listeners for one-shot entrances. Use once: true, a negative margin to start early, and shared variants so parents stagger children without N timelines.

Staggered feature grid

jsx
Loading code…

Batch and respect reduced motion

One parent stagger is cheaper than twenty independent timelines. Cap how many elements move at once—especially on mobile.

Honor prefers-reduced-motion. A static layout that still communicates beats a beautiful stutter.

Adaptive motion gate

jsx
Loading code…

Profile on real devices

Your laptop lies. Record a scroll pass in Chrome Performance on a mid-range Android or throttled CPU. Red marks mean cut properties, cut count, or cut the effect.

Final thoughts

Performance is the product surface users feel first. Stay on transform/opacity, scope scroll work, batch entrances, and verify on hardware that matches your audience—not your workstation.

Motion cost ladder

From static baseline to spring — feel the difference

Live Preview
No Animation
CodeStep 1 of 4
Loading code…

Ready to build something this considered?