No. 89Performance8 min read2,033 words
How we built this site: a living particle system
How our site runs one persistent Three.js particle system behind every page, driven by scroll, without slowing first paint or making a single network request.
- Written by
- Lazy Devs
- Published
- Updated
- Sources
- Cited inline

Key takeaways · 05
The short version
- 01One persistent WebGL scene sits behind every page. Sections declare a shape with a data attribute; the particles morph to it while that section holds the middle of the screen.
- 02Every particle carries its position in every formation as vertex attributes, so a morph is a handful of uniforms changing. The GPU does the blending, with a per-particle delay that turns it into a wave.
- 03Three.js loads lazily after the page has painted and the browser is idle, so the headline is never waiting for WebGL. Measured LCP stayed around 0.18 s with the CPU throttled 4x, with zero layout shift.
- 04Every shape is generated in code, including the LD mark, rasterised from the same vector path as the logo. A full scroll of the home page made two requests, both lazily loaded article covers.
- 05Visual ambition and search fundamentals are not a trade-off: all copy and figures are server-rendered text, headings reveal through CSS masks, and decorative canvases are hidden from assistive tech.
On this page · 15
Most agency sites tell you they care about craft. We wanted ours to show it, without slowing a single page down or giving up anything search engines need. The result is a site where one living particle system runs behind every page and re-forms itself into a new shape for each section you scroll through: our LD mark in the hero, six orbiting clusters for our core services, a flowing stream for our delivery process, a constellation for our technology stack.
This article is how it works, with the real code from this repository and the numbers we measured. If you would rather see it than read about it, the Lab walks through every formation live, one section at a time.
The constraints we set first
Before any WebGL, we wrote down what the visual layer was not allowed to cost:
- First paint never waits for it. The headline has to be readable before the particle system even starts downloading.
- No layout shift. Nothing on the page moves because the visuals arrived.
- No network requests at runtime. Every shape is generated in code. No textures, no models, no video.
- Search engines see everything. All copy and figures are server-rendered text. No number is ever
0in the HTML waiting for a script to count it up. - It stops when nobody is looking. The render loop pauses when the tab is hidden.
These are the same budgets we hold client projects to in our performance and SEO engineering work. Writing them down first meant every creative idea had to fit inside them, rather than being negotiated down later.
One scene, many formations
The obvious way to build animated sections is one canvas per section. We did the opposite: there is exactly one <canvas>, fixed behind the whole site, mounted once in the root layout so it survives page navigations. Sections do not own visuals. They declare which shape the particles should take while they are on screen:
<section data-signal="clusters">…</section>The vocabulary is small: mark, clusters, stream, stars, and a calm field used between sections and on most inner pages. That constraint is what makes the page feel like one continuous system instead of a stack of unrelated demos.
Every particle knows every shape
The core idea is that a morph should cost almost nothing at runtime. Instead of computing new positions on the CPU and uploading them every frame, each particle carries its position in every formation as a vertex attribute, uploaded once when the scene starts. Three.js makes this straightforward with BufferGeometry attributes and a custom ShaderMaterial.
In the vertex shader, two small vectors of weights say how much of each formation to use. A morph is just those weights changing:
// Per-particle stagger: each particle lags the shared weights a little,
// so formations assemble as a wave instead of all at once.
float lag = aRand * uSpread;
vec3 w = clamp((uWeights - lag) / max(1.0 - lag, 0.001), 0.0, 1.0);
vec3 wb = clamp((uWeightsB - lag) / max(1.0 - lag, 0.001), 0.0, 1.0);
float sum = max(w.x + w.y + w.z + wb.x + wb.y + wb.z, 0.0001);aRand is a random number per particle, fixed at startup. Because every particle reaches its target at a slightly different moment, the shape builds up as a wave rather than snapping into place. That single line is most of what makes the motion feel organic instead of mechanical.
Some formations are not static positions at all. The clusters orbit by rotating their positions in the shader over time. The stream stores only a position along its length, an angle and a radius, and the shader turns those into a flowing tube that swells at five points: one for each stage of how we work. Moving that logic into the shader means the CPU sends a time value each frame and nothing else.
The mark is drawn from its own logo
We did not want a 3D model or an image of our logo, both because they would be extra downloads and because they would drift out of sync with the real brand mark. So the particle version is rasterised at startup from the exact SVG path the logo uses:
g.fill(
new Path2D(
"M24 34 H41 V71 H54 V86 H24 Z M58 34 H76 C89 34 98 45 98 60 …",
),
"evenodd",
);
const data = g.getImageData(0, 0, S, S).data;We draw the letters into a small offscreen canvas, read back the filled pixels, and scatter particles across them. The letters get real thickness: most particles sit on a front and a back face with some through the body, so a gentle tilt toward the cursor reads as an object rather than a flat stamp.
Around the letters, about a third of the particles form the frame. They do not sit still: each one knows its position along the rounded-square perimeter and moves along it every frame, so the frame streams like a current, with coral sparks riding the flow. A scan line sweeps down the letters every few seconds by briefly enlarging and brightening particles near a moving height.
Light without post-processing
Glow usually means a bloom pass, which costs a full-screen render or two every frame. We get most of the effect for far less: the same particles are drawn twice. The second pass shares the geometry and every uniform but sets a single flag, uHalo, that makes each point three to four times larger and almost transparent. With additive blending the overlapping soft discs read as light.
The pointer adds a ripple: particles within a radius of the cursor are pushed outward, lifted toward the camera and given a travelling sine wave, all computed in the vertex shader from one uniform. The force eases in when the pointer moves and fades when it rests, so the field never feels twitchy.
Scroll is the timeline
Formations are driven by GSAP's ScrollTrigger. When a page loads, the stage finds every element with a data-signal attribute and creates a trigger for it:
ScrollTrigger.create({
trigger: el,
// Sections may delay their formation (e.g. until a sticky stage settles).
start: el.dataset.signalStart ?? "top 55%",
end: el.dataset.signalEnd ?? "bottom 45%",
onToggle: pick,
});Whichever section holds the middle of the viewport wins, and GSAP tweens the weights and the formation's placement on screen with an expo.inOut ease. Placement matters as much as shape: on desktop most formations sit in the right half, where their section leaves open space, and on phones they move behind the content, smaller and dimmer, so they never compete with the text.
Smooth scrolling comes from Lenis, wired into GSAP's ticker so every trigger reads the same smoothed position:
lenis = new Lenis({ lerp: 0.1, wheelMultiplier: 1, anchors: true });
lenis.on("scroll", ScrollTrigger.update);
gsap.ticker.add((time) => lenis?.raf(time * 1000));Native scrolling stays the source of truth, so sticky elements, anchor links and find-in-page keep working.
Loaded after first paint, paused when hidden
The engine is never part of the critical path. The canvas element is in the server-rendered HTML, but Three.js and the engine are a dynamic import that only starts once the browser reports it is idle, using requestIdleCallback with a short timeout as a safety net. If WebGL is unavailable the page simply stays on its flat dark ground.
Once running, the render loop listens to the Page Visibility API and stops entirely when the tab is hidden. The particle count is decided once at startup: about 18,000 on desktop, 11,000 on machines reporting four or fewer cores, and 7,000 on phones, with the pixel ratio capped so high-density screens do not quietly multiply the work.
The site is server-rendered with Next.js and hosted on Cloudflare Workers via OpenNext; we compare that set-up with the alternatives in best hosting for Next.js. The checks we ran before shipping are the same ones in our Core Web Vitals checklist.
Headlines that animate without hurting LCP
Largest Contentful Paint is usually the headline on a page like ours, so it must render immediately. Our word-by-word heading reveals are pure CSS: each word sits in its own mask and rises into place with a staggered animation-delay. No JavaScript has to run first, the words are real text in the HTML, and the browser can paint them on the first frame.
Further down the page, reveals wait until they scroll into view, and if JavaScript never runs at all a <noscript> rule releases every animation so nothing stays hidden.
Numbers search engines can read
Counting numbers are a classic SEO trap: the HTML says 0, a script counts up to 700, and crawlers that index the initial markup see zero. Our counter renders the real value on the server and only animates in the browser, starting from the number that is already there. Before shipping, we fetched the raw HTML of our key pages and checked that every figure appears with its true value.
Shapes that come from real data
A visual that only looks good is decoration. We wanted the formations to mean something, so two of them are generated from the same data the pages use.
The service clusters map one-to-one to our six core services. Hovering a service in the list dispatches a small browser event with its index, and the shader brightens that cluster, enlarges its particles and tints it coral while the other five dim. No component reaches into the WebGL scene directly; the event is the whole interface.
The technology constellation is built from a single shared list of the 24 technologies we work with, grouped into four bands: languages, frameworks, data and infrastructure. The faint lines between stars are not decorative either. They are drawn from the pairings we actually ship together, such as Next.js with React, TypeScript and Vercel, or PostgreSQL with Prisma and Redis. Hovering a technology in the index lights its star, its partners and the lines between them. Because the index and the constellation read the same data, they cannot drift apart when the stack changes.
Accessibility and fallbacks
The canvas is marked aria-hidden, because it carries no information that is not already in the text. Every interactive element that drives the particles, such as the service and technology lists, is a real link or button that works with a keyboard and has a visible focus state, and does something useful without the particles at all.
Pointer effects only switch on for devices with a precise pointer, so phones and tablets get the scroll-driven formations without hover behaviour that cannot be triggered by touch. If a browser cannot create a WebGL context, the engine never starts and the page is simply the dark, fully readable design underneath.
The habits behind this are in our accessibility guide for developers.
What we measured
On a production build of the home page, with the CPU throttled four times:
| Measurement | Result |
|---|---|
| Largest Contentful Paint | about 0.18 s |
| Cumulative Layout Shift | 0 |
| Particles on desktop / phones | about 18,000 / 7,000 |
| Requests during a full home-page scroll | 2 (lazily loaded article covers) |
Those two requests are images that load as you reach the articles section. The particles, the formations and every animation on the page made none.
Page transitions
Between routes, the content cross-fades and rises into place using React's ViewTransition and the browser's View Transitions API, while the header and the particle canvas stay put. Because the canvas lives in the root layout, the particles do not restart on navigation: they re-form into the next page's shape.
What we would tell a client
None of this required exotic tooling. It is a set of decisions applied consistently: put heavy work on the GPU, load heavy libraries after first paint, pause what nobody can see, keep content as server-rendered text, and measure before claiming anything. Those decisions carry over directly to product work, whether it is a data-heavy dashboard or a launch page that has to make an impression without losing search traffic.
If you want something ambitious built without giving up speed or search, tell us what you are building. And if you want to see every formation described here running live, the Lab is the demo.
Curious how other companies' sites compare? We measured all 100 Forbes Cloud 100 homepages the same way.
FAQ · 04 questions
Frequently asked questions
Does a WebGL background hurt Core Web Vitals?
It does not have to. LCP is measured on the largest text or image element, not on a canvas that starts after it. We load Three.js only after the page has painted and the browser is idle, keep the canvas fixed so it never shifts layout, and keep the main thread free during interactions. On our home page, LCP measured about 0.18 seconds with a 4x CPU slowdown and CLS was 0.
Why not use a pre-rendered video for the hero?
A video is a large download, cannot react to the cursor or to scroll, and cannot re-form into a different shape for each section. The particle system is a small amount of code that runs on the visitor's GPU, responds to them, and costs no extra network requests after the page loads.
How many particles does the site render?
About 18,000 on desktop, 11,000 on machines with four or fewer CPU cores, and 7,000 on phones. The count is decided once at startup from the screen width and the reported core count, and the pixel ratio is capped so high-density screens do not multiply the cost.
Is this approach usable for a client product, or only for marketing sites?
The same techniques apply anywhere you need rich visuals without hurting performance: lazy-loading heavy libraries after first paint, moving work to the GPU, pausing loops when they are not visible, and keeping content server-rendered. We use them in dashboards, product pages and data visualisations as much as in marketing sites.