Performance · Case study

How I kept a pinned three.js scroll scene at Lighthouse 100 on mobile

A pinned three.js scroll scene scored 60 on mobile PageSpeed at launch, with 17 seconds of Total Blocking Time; the final page scores 100 on all four categories (FCP and LCP 1.1 s, TBT 0 ms, CLS 0) with the scene intact. The cause was that Lighthouse renders WebGL in software, so a loop that never idles produces only long tasks. Fixes: no WebGL before first paint, a GPU check in a Web Worker on an OffscreenCanvas after first contentful paint, software renderers start only after an interaction in a low-power mode, a hidden footer, and degrading resolution before frame rate. A static fallback covers no WebGL 2 and prefers-reduced-motion.

Disclosure The page described is the author's own web studio homepage.

Read at source
All tutorials