All components

14 components

WebGL and Shader Backgrounds for React

A shader background gives a page depth that CSS gradients can't: light moving through water, clouds rolling past, satin catching a highlight. These React components each run a single small fragment shader on the GPU, with no three.js or other 3D library to install. They pause when off screen or in a background tab, cap their resolution on high-density displays to protect battery life, release their WebGL context when unmounted, and render a single still frame for reduced-motion users.

A WebGL shader of slow, folding liquid colour, like ink in water, with film grain and a swirl that follows the cursor.

Sunlight on the floor of a pool: a shifting web of light over deep water, edged with a faint rainbow, that swells as the cursor passes.

Above the clouds at golden hour: banks of cloud drift past in three depths, lit on the edges facing a glowing sun, parting as the cursor passes.

A calm sea at night: stars over the horizon, a haloed moon, and a long path of glitter on the water that shivers with every swell. The moon drifts after the cursor.

Sunlight through leaves on a warm wall: soft round spots of sun open and close as the canopy sways, and leaf shadows drift across. Komorebi, in a shader.

A polished slab of dark marble with fine veins that wander and branch like real stone, and seams of gold that glint as a light drifts along them.

A length of champagne satin, draped and slowly billowing, with a narrow sheen sliding along every fold. The cursor lifts the fabric as it passes.

Ribbons of iridescent glass drifting through the dark, twisting to bright edges side-on and blooming with colour face-on, like light on a soap film.

Drops of iridescent liquid glass drifting in the dark, merging and pulling apart as they pass. The cursor drags a drop of its own through them.

The colours of a soap bubble spread across the dark: bands of interference colour swirl, streak and fade to black where the film is thinnest. The cursor stirs it.

A ribbon woven from dozens of fine threads of spectral light, gathering into a bright seam where it turns side-on and fanning into a veil of colour.

A piece of studio glass turning slowly in the dark, a ring, sphere or rounded cube, with softbox strips sliding across it and light splitting into colour at its edges.

A slowly flowing liquid-metal surface with studio reflections, rendered in WebGL, that swells gently under the cursor.

Soft smoke drifting slowly across the background in a WebGL shader, parting around the cursor. Calm enough to sit behind text.