Guide · Performance

Core Web Vitals for heavy animated websites

By Md Mahafuj Alam · Updated

A scroll story can pass Core Web Vitals if the frames never compete with the first paint. Make a poster image the LCP element and fetch it at high priority, start the frame download after load, keep per-frame work on the main thread small so taps respond quickly, and reserve space for pinned sections and fonts so nothing shifts. The targets are LCP within 2.5 seconds, INP within 200 milliseconds and CLS of 0.1 or less, measured at the 75th percentile of real visits.

The three metrics and their thresholds

Core Web Vitals are three field metrics Google uses to describe loading, responsiveness and visual stability. The current thresholds, as published on web.dev, are below.

MetricMeasuresGoodPoor
LCP, Largest Contentful PaintWhen the largest visible image or text block finishes rendering2.5 s or lessOver 4 s
INP, Interaction to Next PaintHow long the page takes to paint after a click, tap or key press200 ms or lessOver 500 ms
CLS, Cumulative Layout ShiftHow much visible content moves unexpectedly0.1 or lessOver 0.25

Two rules decide whether you pass. First, the value that counts is the 75th percentile of real page loads, so three in four visits must meet the target. Second, mobile and desktop are assessed separately. A scroll story that is fast on a desktop fibre line and slow on a mid-range phone fails on mobile, and mobile is usually where the traffic is.

What the LCP element is on a scroll-story hero

LCP only considers certain element types: img elements, image elements inside SVG, video elements, elements with a CSS background image loaded through url(), and block-level elements containing text. A canvas is not on that list. Pixels you draw onto a canvas never become the LCP element, however large they are.

That matters for scroll stories, because the hero is usually a full-screen canvas showing frame one. If the canvas is the only visual, the browser picks the next largest candidate, usually the headline text, and LCP reflects when that text painted. That can look good in a report while the visitor still stares at an empty canvas waiting for frames.

The honest approach is to render a real img poster of frame one in the HTML, behind or in place of the canvas. The poster becomes the LCP element, it shows the visitor the scene immediately, and the canvas takes over once the sequence is ready. Two Chromium details to respect: elements at opacity 0 are excluded from LCP, and so are low-entropy placeholder images. A blurred 20-pixel placeholder will not count; the real poster will.

For a video hero, the browser uses whichever comes first: the poster image load or the first frame presented. Either way, give the video a poster.

Load the poster first with fetchpriority

In Chromium, images start at low fetch priority (the first five large images at medium, since Chrome 117) and viewport images are raised to high only at layout time. fetchpriority="high" tells the browser to fetch the poster at high priority from the start. Do not lazy-load it.

components/Hero.tsxtsx
export function Hero() {
  return (
    <section className="relative h-svh">
      <img
        src="/frames/hero-poster.webp"
        alt="A glass tower at dusk, seen from the river"
        width={1920}
        height={1080}
        fetchPriority="high"
        decoding="async"
        className="absolute inset-0 h-full w-full object-cover"
      />
      <canvas id="story-canvas" className="absolute inset-0 h-full w-full" />
    </section>
  );
}

If you use next/image, note that Next.js 16 deprecated the priority prop in favour of preload, and the docs recommend fetchPriority="high" or loading="eager" in most cases. With output: 'export' the default image loader is unavailable, so most static builds set images.unoptimized and serve pre-sized files. Export the poster at the size the hero actually renders and in WebP or AVIF.

Keep the poster identical to frame one of the sequence. When the canvas draws its first frame over it, nothing visibly changes.

Defer the frame download

A sequence of several hundred frames can weigh tens of megabytes. If those requests start during page load, they compete with the poster, the CSS and the fonts for bandwidth, and LCP slips. The fix is ordering, not removal.

  1. Paint the poster and the copy from HTML.
  2. Wait for the load event, or for the poster's own load, before requesting frames.
  3. Fetch the first chapter's frames first, then the rest in scroll order.
  4. Use a light, low-resolution tier for the first pass and upgrade nearby frames to full resolution as the visitor scrolls.

The Kestra template takes this approach: 443 frames, about 26 MB, delivered in two tiers. Light previews load first, then 1920 × 1072 HD frames stream in, loaded nearest the scroll position, with far frames released from memory. Phones get separate 9:16 portrait frames. It scores 90 on mobile. The canvas image sequence guide walks through the loader itself.

Main-thread work during scroll, and INP

INP observes clicks, taps and key presses. Scrolling itself is not counted. That does not let scroll stories off the hook: if the main thread is busy decoding frames and running scroll callbacks when the visitor taps the menu, the tap waits. That wait is the input delay part of INP, and it is where animated sites lose points.

Keep the per-frame callback small

The ScrollTrigger onUpdate callback runs many times a second. It should do one thing: draw an already-decoded image to the canvas. No DOM reads that force layout, no state updates that re-render React, no array allocations.

Decode off the critical moment

Decoding a large JPEG or WebP on the main thread is expensive. Decode frames ahead of need with createImageBitmap() or img.decode(), which returns a promise, so the draw call never pays the decode cost.

lib/loadFrame.tsts
export async function loadFrame(url: string): Promise<ImageBitmap> {
  const res = await fetch(url);
  const blob = await res.blob();
  return createImageBitmap(blob);
}

Break up long tasks

When you queue a batch of frame requests or build the three.js scene, split the work so the browser can handle input between chunks. Await a short timeout or requestIdleCallback between batches rather than processing everything in one loop.

Avoiding layout shift from pinned sections and fonts

CLS has a detail that catches scroll stories. Shifts within 500 milliseconds of a tap, click or key press are excluded, but scrolling does not count as recent input. A layout shift that happens while the visitor scrolls counts in full in field data.

  • Pin spacers. ScrollTrigger adds spacing when it pins a section. If that happens after the page has painted, everything below jumps. Initialise pins early, and give pinned sections their final height in CSS so the spacer does not change the layout.
  • Late refreshes. Calling ScrollTrigger.refresh() after images or fonts load recalculates positions. Reserve space for those assets so a refresh changes nothing visible.
  • Fonts. A web font that swaps in with different metrics reflows every heading. next/font self-hosts fonts and, by default, generates an adjusted fallback font to reduce this shift.
  • Media without size. Give every img, video and canvas explicit dimensions or an aspect-ratio.
  • Animate with transforms. Moving elements with transform does not cause layout shifts. Animating top, height or margin does.

Lab data and field data: Lighthouse versus CrUX

Lighthouse is a lab tool. It loads the page once, on one simulated device and network, with a cold cache. It is repeatable and useful during development, but it cannot measure INP because no real person interacts. It reports Total Blocking Time instead, which measures how long the main thread was blocked during load. A page can have good TBT and poor INP.

The Chrome UX Report (CrUX) is field data from real Chrome users, aggregated over a rolling 28-day window. It is the source for the Core Web Vitals assessment in PageSpeed Insights and Search Console. Expect differences between the two:

  • Lab CLS only covers shifts during load. Field CLS includes shifts while visitors scroll, which is where scroll stories shift most.
  • Lab LCP uses a cold cache; returning visitors in the field often load faster.
  • A change you ship takes up to 28 days to work fully through CrUX.

Use Lighthouse to catch regressions before you deploy. Use CrUX, or your own real-user monitoring with the web-vitals library, to judge whether you actually pass.

Set a performance budget

A budget turns these principles into numbers you check on every build. The figures below are a starting point for a mobile scroll story, not a standard. Adjust them to your audience and footage.

ItemStarting budgetWhy
Poster imageUnder 150 KBIt is the LCP element; it must arrive fast on mobile.
JavaScript before first paintAs small as possible; defer three.jsParsing and running scripts delays LCP and INP.
Frames requested before loadNoneKeeps bandwidth for the poster, CSS and fonts.
Mobile frame setSeparate, smaller, portraitPhones need fewer pixels and less memory.
Main-thread task during scrollWell under 50 msTasks longer than 50 ms count as long tasks.
CLS on scroll0 from pins and fontsEvery shift during scroll counts in the field.

Check the budget in Lighthouse on every pull request, then confirm in field data once the site is live. For the wider build, start with the complete guide to building a 3D website with Claude, and see how finished templates handle this in the template catalogue.

FAQ

Questions, answered.

The questions people ask most about this topic.

01Can a website with hundreds of animation frames pass Core Web Vitals?

Yes, if the frames load after the first paint. Canvas content is not an LCP candidate, so a fast poster image can carry LCP while frames stream in afterwards. INP and CLS depend on keeping scroll work light and reserving space for pinned sections.

02Is a canvas ever the LCP element?

No. LCP considers img elements, image elements inside SVG, video elements, CSS background images loaded with url(), and block-level text. Canvas is not on the list, so render a real img poster if you want the hero visual to be the LCP element.

03Does scrolling affect INP?

Scroll events are not measured by INP. Heavy work during scroll still hurts INP indirectly, because a tap or click that arrives while the main thread is busy has to wait.

04Why does Lighthouse say my CLS is fine when Search Console says it is poor?

Lighthouse measures layout shifts during load only. Field data from CrUX includes shifts that happen while real visitors scroll, which is where pinned sections and late refreshes cause shifts on animated sites.

05How long do Core Web Vitals take to update after a fix?

CrUX aggregates real-user data over a rolling 28-day window, so a fix reaches the full report gradually over about four weeks.