Smooth scrolling without hurting LCP

Draft awaiting the owner’s review. It isn’t indexed or in the RSS feed yet. Every number in it comes from a Lighthouse or audit file, available on request.

Smooth scrolling is part of every Kanini Labs page. It's also a common way to make a page slower: a scroll library and an animation library, loaded in the head, compete with the headline for the first second.

Boundary Bay Freight is a concept project, a landing page for a pallet carrier, designed and built by Kanini Labs. It has smooth scrolling and section reveals, and on mobile Lighthouse it scores 100 with a 0.9 s Largest Contentful Paint (LCP) on all five runs. Here's how the motion stays out of the way.

The numbers

Lighthouse 13.6.0, mobile profile, five runs on the production build: performance 100 every time, First Contentful Paint 0.9 s, LCP 0.9 s, cumulative layout shift 0, and total blocking time between 0 and 20 ms. The LCP element was the hero headline every time. Source: the Lighthouse reports from that series, available on request.

1. One scroll system, on one clock

Lenis does the smooth scrolling, and GSAP's ticker drives it, so there's one animation loop on the page instead of two:

const lenis = new Lenis({ autoRaf: false });
lenis.on("scroll", ScrollTrigger.update);
gsap.ticker.add((time) => lenis.raf(time * 1000));
gsap.ticker.lagSmoothing(0);

ScrollTrigger reads the same scroll position Lenis writes, so anything tied to scroll stays in step with it.

2. Load it after the page, not before

GSAP, ScrollTrigger and Lenis sit in their own chunk, 49 KB gzipped, and it's imported after the load event, or on the visitor's first wheel, touch, key or scroll if that comes sooner. Nothing in the first screen needs it, so it never competes with the headline, as Boundary Bay's build plan sets out.

It also loads only where it's useful: on screens 768 px and wider, when the visitor hasn't asked for reduced motion. Phones keep native scrolling, which is already smooth and which people expect to behave the way it always does.

3. Reveals that can't shift the layout

Sections fade in and rise 18 px as they scroll into view. Three rules keep that from hurting the score:

  • Only elements below the first screen are armed, and only after load. Nothing the visitor can already see changes.
  • The reveal is opacity and transform. Neither moves anything else on the page, so cumulative layout shift stays at 0.
  • It doesn't need GSAP. One IntersectionObserver toggles a CSS class, in a chunk of about 1 KB, so phones get the reveals without the scroll library.

With reduced motion, nothing is armed and everything is visible from the start. If the setting changes while the page is open, the motion is torn down or built up again.

4. Watch what becomes the LCP element

Two of Boundary Bay's fixes had nothing to do with motion. On phones, the hero photo first beat the headline as the largest element, so it became a short band that loads lazily, and the headline is the LCP element again. Later, the paragraph under the headline grew longer than the headline at 360 to 412 px wide, and Lighthouse picked the paragraph. A clause came out of the paragraph. Both are in the plan's change log, which is available on request with the audit files.

A note on Lighthouse versions

An earlier series on Lighthouse 12.8.2 scored 95 to 99, with an LCP of 2.1 to 2.8 s, on the same final build. In both versions the LCP element was the headline. The site's audit records the difference as the way 12.8.2 simulates a text LCP, and the real-browser check measured the headline painting well under a second. The figures quoted here are the 13.6.0 runs, with the version named.

The build, its decisions and screenshots are on the Boundary Bay case page.

Need a page like this?

Launch pages from $300, 3D launch pages from $500, MVPs from $1,000. Fixed price, agreed first.

Book a 30-min intro call