Skip to content
> GRID ........ OK
> BUILD ....... OK
> DEPLOY ...... OK
07 — INSIGHTS

How to have a heavily animated website that still passes Core Web Vitals

10 minHexort EngineeringPerformance · Motion · Websites

An engineering playbook for cinematic motion, WebGL and scroll animation that keeps LCP, INP and CLS in the green — with budgets, loading order and fallbacks.

There's a widespread belief that you have to choose: either a site that feels alive, or a site that's fast. In our experience, that's false — but only if performance is a design input rather than something you try to fix the week before launch.

This is the playbook we use for animated websites. It assumes you care about Google's Core Web Vitals, and that you want real people on mid-range phones to have a good time, not just a reviewer on a studio monitor.

The three numbers that matter

Core Web Vitals are three metrics Google uses to describe real-user experience. Google's thresholds for "good", measured at the 75th percentile of real visits, are:

  • Largest Contentful Paint (LCP) — how long until the largest visible element (usually the hero headline or image) is rendered. Good: 2.5 seconds or less.
  • Interaction to Next Paint (INP) — how quickly the page visually responds to taps, clicks and key presses, across the whole visit. Good: 200 milliseconds or less. INP replaced First Input Delay as a Core Web Vital in March 2024.
  • Cumulative Layout Shift (CLS) — how much content jumps around unexpectedly. Good: 0.1 or less.

Animation can hurt all three. Heavy JavaScript delays LCP. Busy main threads make interactions sluggish and damage INP. Content that appears late or resizes after load causes layout shift. The good news is that each of these has a specific, engineering-level fix.

Rule 1: the headline is not an animation

The most important decision on an animated site is what the browser paints first. Our rule: the hero headline is real text, rendered on the server, visible without JavaScript.

That headline is usually the LCP element. If it only appears after a JavaScript animation library loads and runs, LCP is tied to your bundle size and the visitor's CPU. If it's already in the HTML, the browser can paint it almost immediately, and your animation can enhance it afterwards — masking lines, revealing characters — without delaying the metric.

In practice:

<!-- Good: text is in the server HTML, animation enhances it -->
<h1 class="hero-title">Websites engineered to perform.</h1>

Then, after hydration, split the lines and animate them in. If JavaScript fails or the user prefers reduced motion, they still see the headline.

Avoid patterns that hide content until JavaScript runs, such as setting opacity: 0 in CSS and relying on a script to fade it in. If the script is late, so is your LCP.

Rule 2: budget before you design

We set a performance budget at the start of every project and check designs against it. A typical budget for a marketing site looks like:

Budget Target
LCP on throttled mid-range mobile under 2.0 s
CLS under 0.05
INP under 200 ms
JavaScript on first load as small as practical; heavy libraries deferred
Hero media sized, compressed, modern formats

The point isn't the exact numbers; it's that motion ideas are weighed against them. A pinned scroll scene might cost 40 KB of code and be worth it. A full-screen video background that autoplays on mobile probably isn't.

Rule 3: load heavy things later

WebGL and 3D scenes are where the "wow" usually lives, and also where the weight lives. Three.js and its helpers are substantial libraries, and compiling shaders takes time on a phone's GPU.

Our loading order:

  1. Server HTML and CSS. Text, layout and a static poster image or SVG for any 3D scene. The page looks complete.
  2. Hydration. Interactive components come alive. Light motion (text reveals, hover states) starts.
  3. After first paint and idle time, check whether the device can handle WebGL — capability, memory, reduced-motion preference — and only then dynamically import the 3D code.
  4. Fade the canvas in over the poster, so there's no layout change and no flash.

Two details matter here. First, the poster and the canvas occupy the same reserved box, so swapping one for the other causes zero layout shift. Second, the dynamic import means the 3D library never sits on the critical path for LCP.

Rule 4: keep the main thread free

INP is about responsiveness across the whole visit, so it punishes sites that keep the main thread busy. Common causes on animated sites:

  • Animating layout properties. Animating width, height, top or left forces the browser to recalculate layout every frame. Animate transform and opacity instead; browsers can usually handle those on the compositor.
  • React state updated every frame. Storing scroll position or cursor coordinates in component state re-renders the tree 60 times a second. Keep per-frame values in a plain mutable object or a ref, and read them inside the animation loop.
  • Unthrottled scroll handlers. Use a single, well-tested scroll system — for example, a smooth-scroll library synced to the animation library's scroll triggers — rather than dozens of independent listeners.
  • Long tasks during interaction. If a tap opens a menu, the menu should appear in the next frame; any expensive work can follow.
// Per-frame input lives outside React state
const state = { progress: 0, pointerX: 0, pointerY: 0 };
window.addEventListener("pointermove", (e) => {
  state.pointerX = e.clientX / innerWidth - 0.5;
  state.pointerY = e.clientY / innerHeight - 0.5;
}, { passive: true });

Rule 5: never let animation move the layout

CLS is the easiest of the three to protect, and the easiest to break. Animated sites cause shift when:

  • fonts swap and change line lengths (fix: preload the display font, use font-display: swap with a well-matched fallback, and reserve space for headlines);
  • images or canvases load without dimensions (fix: always set width and height, or an aspect-ratio);
  • elements animate in by changing their size or position in the document flow (fix: animate transforms on elements whose space is already reserved);
  • banners and preloaders push content down (fix: make them overlays, not part of the flow).

A preloader, for instance, should be a fixed overlay on top of a fully rendered page — never a gate that keeps the real content out of the HTML.

Rule 6: pause what nobody is looking at

A 3D scene at the top of the page keeps consuming GPU and battery after the visitor scrolls past it. Use an IntersectionObserver to pause the render loop when the canvas leaves the viewport, and resume when it returns. Cap the device pixel ratio (rendering at 3× on a high-density phone is rarely visible and very expensive), and reduce particle counts or effects on smaller screens.

Rule 7: respect reduced motion

Some visitors set their operating system to reduce motion because animation causes discomfort or nausea. The CSS media query prefers-reduced-motion: reduce exposes that preference. Honouring it is an accessibility requirement and also a useful performance fallback:

  • disable smooth-scroll hijacking and pinned scroll scenes;
  • replace 3D scenes with their static posters;
  • turn reveals into simple fades or show the final state immediately.
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

That blanket rule is a safety net, not the whole solution; design the reduced-motion version deliberately so it still communicates what the animation did.

Rule 8: measure in the field, not just the lab

Lab tools such as Lighthouse are great for catching regressions, but Core Web Vitals are assessed on real-user data. Test on a throttled mid-range Android device, not just a fast laptop. After launch, watch field data — Google Search Console's Core Web Vitals report and the Chrome UX Report summarise real visits — and consider collecting your own with the open-source web-vitals library so you can see which pages and devices struggle.

A pre-launch checklist

Before any animated site of ours goes live, we check:

  • the hero headline is in the server HTML and visible with JavaScript disabled;
  • heavy 3D and animation libraries are loaded after first paint, not in the initial bundle;
  • every image, video and canvas has reserved dimensions;
  • animations use transform and opacity, not layout properties;
  • per-frame values never trigger component re-renders;
  • off-screen canvases pause; device pixel ratio is capped;
  • reduced-motion mode has been designed and tested;
  • LCP, INP and CLS are within budget on a throttled mid-range phone.

The point

Fast and animated aren't opposites. A slow animated site is usually the result of motion designed in isolation and performance treated as a clean-up task. Make the budget part of the brief, render the important things first, load the spectacular things later, and give every visitor a version of the experience their device and preferences can handle.

Written by

Hexort Engineering

The design engineers at Hexort, a Dubai, UAE studio building flagship websites, Shopify and WooCommerce stores. We write about what we've learned shipping them.

Planning something similar?

Tell us what you're launching. You'll get a straight answer on scope, timeline and fit.

Comms