projects
Design studio / WebGL / 2024live

BeigePill.

A studio site revealed through growing dots, rebuilt in WebGL.

Role
Lead Developer
Where
BeigePill · FutureCorp
Built with
Next.js 14 · React 18 · React Three Fiber · Three.js · GLSL · GSAP · Sanity CMS · Mux

The design needed full-screen images and video revealed through a growing grid of circles, tied to scroll. The first prototype used CSS clip-path: animating it repaints constantly, overlapping shapes behaved differently between browsers, and it stuttered on mobile.

I moved the whole composition into a React Three Fiber canvas. Each dot is a circle mesh that writes into the stencil buffer through drei's <Mask>, and the slide's image or video plane only draws where the stencil matches. GSAP ScrollTrigger scrubs a 0 → 1 progress value per slide, and that value sets the dots' radius.

WebGLstencil-buffer mask instead of clip-path
GSAPScrollTrigger progress scrubbed to scroll
CMSSanity Studio with draft preview
ScrollGSAP ScrollTrigger · scrubProgress 0 → 1one per slideDot gridradius follows progressStencil bufferwritten by <Mask>Image or video planeSanity · Mux · fit shaderstencil test
Scroll becomes a progress value, the progress sets the dot radius, the dots write the stencil buffer, and the slide only draws where they wrote.

The mask lives in the stencil buffer

Each dot is a circle mesh inside drei's <Mask>, which writes an id into the stencil buffer instead of drawing colour. The slide's image or video plane uses the matching stencil test, so it only appears inside the dots.

Scroll drives it directly

A scrubbed GSAP ScrollTrigger maps each slide's trigger element to a progress value between 0 and 1, and the dot radius follows it linearly up to a maximum that depends on the screen size. Scrolling back reverses the reveal exactly.

Any image size fits its frame

A small fragment shader fits the texture to the full-screen plane like object-fit: cover. When an image is taller than the screen, a second scroll value pans it vertically.

The dot pattern is hand-authored

The dots come from a hand-written grid of 1s and 0s, and each slide starts reading it at a random column, so partial reveals look designed rather than noisy.

Fleming.Watch