All posts
Frontend

WebGL without killing performance

You can ship a beautiful animated hero and still hit a 100 Lighthouse score. Here is the budget I work within.

6 min read#WebGL#Performance#Next.js
WebGL without killing performance

Motion sells, but jank loses. The goal is a hero that feels alive without stealing the milliseconds that decide whether a visitor stays.

Progressive enhancement, always

The content renders first as plain server-side HTML. The WebGL layer hydrates on top of it, so the page is readable and indexable long before a single shader compiles.

Respect the device

Cap the pixel ratio, pause the render loop off-screen, and honor prefers-reduced-motion. A phone on battery should never run the same loop as a desktop GPU.

  • Clamp devicePixelRatio to 2.
  • Stop rendering when the canvas leaves the viewport.
  • Provide a static fallback for reduced-motion users.
Performance is a feature. A 100 score with motion intact is a design constraint, not a trade-off.