Guide ·

Scroll Animations That Don't Slow Down Your Website or Hurt Core Web Vitals

How to add scroll-reveal effects, sticky cards and hover motion to a business website while keeping LCP, CLS and INP healthy, with a checklist to test.

By Ritesh Singh, full-stack developer

Sections that fade in as you scroll, cards that stack on top of each other, a hero that reacts to the mouse: done well, animation helps a visitor follow the story of a company website. Done badly, it makes the page feel heavy on a mid-range phone, shifts content after it has loaded and drags down the Core Web Vitals that Google uses as a page experience signal. These are the rules I follow when I build animated sites, including the animated software-company website with sticky stacking cards and scroll-reveal sections.

1. Know which metrics animation can hurt

Three Core Web Vitals matter here. Largest Contentful Paint (LCP) measures when the main content, usually the hero heading or image, is shown; it suffers when that content starts hidden and waits for a script to reveal it. Cumulative Layout Shift (CLS) measures how much visible content jumps around; it suffers when an animation changes an element's size or position in the layout. Interaction to Next Paint (INP) measures how quickly the page responds to taps and clicks; it suffers when scroll handlers and heavy animation libraries keep the main thread busy. Every rule below protects one of these three.

2. Animate only transform and opacity

Browsers can move, scale and fade an element with transform and opacity without recalculating the page layout. Animating top, left, width, height, margin or padding forces the browser to lay out the page again on every frame, and on a slow phone that shows up as stutter. A typical reveal therefore starts at opacity: 0; transform: translateY(24px) and transitions to opacity: 1; transform: none. Because transforms do not affect layout, the space for the element is reserved from the start and nothing below it moves, so the reveal adds no layout shift.

3. Use IntersectionObserver, not scroll listeners

The old way was a scroll listener that measured every element with getBoundingClientRect(), many times per second on the main thread. IntersectionObserver lets the browser tell you when an element enters the viewport, with no work on every scroll. Create one observer for the whole page, observe every element with a reveal class, add an in class when entry.isIntersecting is true, and call unobserve() on that element so it only animates once. A small rootMargin such as 0px 0px -10% 0px starts the effect just before the element is fully in view. I used this for the scroll-reveal system on the case study above; it is a few lines of plain JavaScript, no library needed.

4. Never hide the hero or the LCP element

The most common mistake is giving the hero heading or image the same fade-in as everything else. The content has loaded but stays invisible until JavaScript runs and the animation ends, and LCP waits with it. Keep content above the fold visible from the first paint. If you want motion in the hero, animate a decorative element or use a short CSS-only entrance that does not start from opacity: 0 on the main heading.

Also make sure content still appears without JavaScript. Apply the hidden starting state only when a script has run, for example by adding a js class to the html element in a tiny inline script and writing the CSS as .js .reveal { opacity: 0; }. If the main script fails or loads late, visitors and search engines still see every section.

5. Respect prefers-reduced-motion

Some people set their device to reduce motion because large movement makes them unwell or distracts them. Wrap transitions in @media (prefers-reduced-motion: reduce) rules that switch them off, and check matchMedia('(prefers-reduced-motion: reduce)') in JavaScript before starting any looping or scroll-driven effect. With reduced motion on, reveals should simply show the content, and parallax, auto-playing carousels and floating characters should stay still.

6. Sticky and stacking cards: let CSS do the work

Stacking cards, where each card sticks near the top of the screen while the next one slides over it, can be built with position: sticky and a different top offset per card. No scroll math is needed, and the browser handles it smoothly. The catch comes with smooth-scroll libraries. Libraries that move the whole page with a transform instead of letting it scroll natively break position: sticky, so sticky sections then need the library's own sticky feature or a version of the library that keeps native scrolling. On the software-company site, the stacking-card section was built to stay compatible with Locomotive Scroll, which is the kind of detail to settle before choosing a library. Often the better answer is native scrolling, which is already smooth on modern phones and keeps sticky elements, anchor links and keyboard scrolling working.

7. Keep the JavaScript small

A fade-in does not need a large animation library; CSS transitions plus one IntersectionObserver cover most business sites. If one page needs a heavier library for a complex sequence, load it only on that page, with defer or a dynamic import. In Next.js, keep animated parts in small client components so the rest stays server-rendered; my Next.js SEO checklist explains why that matters for ranking. For hover and click effects, change a class and let CSS animate it, so the response to a tap is immediate and INP stays low.

8. Images and widgets that arrive late

Give every image a width and height (or an aspect-ratio) so the browser reserves its space before it loads, and use loading="lazy" only for images below the fold, never for the hero. Floating widgets such as a chatbot button should use position: fixed and load their scripts after the main content. Cookie banners and announcement bars should overlay the page rather than push it down, because they are a common hidden source of layout shift.

9. How to test before launch

Run PageSpeed Insights on the home page and the longest page, but do not stop at the score. In Chrome DevTools, set CPU throttling to 4x slowdown in the Performance panel, record a scroll from top to bottom and look for long tasks. In the Rendering tab, turn on Layout Shift Regions to see anything that jumps, and emulate prefers-reduced-motion: reduce to check the page still works. After launch, the Core Web Vitals report in Google Search Console shows what real visitors experience, which matters more than any lab score.

Checklist

  • Animations use only transform and opacity.
  • Scroll reveals use one IntersectionObserver and run once per element.
  • Hero heading and hero image are visible on first paint.
  • Content is visible if JavaScript fails.
  • prefers-reduced-motion turns motion off in CSS and JavaScript.
  • Sticky sections use position: sticky and still work with any smooth-scroll library.
  • No heavy animation library loaded on pages that do not need it.
  • Images have dimensions; only below-the-fold images are lazy-loaded.
  • Widgets and banners overlay the page instead of pushing it down.
  • Tested with 4x CPU throttling, layout shift regions and reduced motion.

Animation and speed are not a trade-off if the effects are built with these rules from the start. If you want a business website or landing page that feels modern and still loads fast, or need an existing Next.js or React site sped up without losing its look, send me a short project brief and I will reply within 24 hours.

In practice

Case studies using this approach

Related services

Hire me for this

Want this done for your product?

Start your project →