Skip to content

No.129 · Backgrounds

Mercury Glass

Drops of clear glass drifting over a fine printed pattern and bending it like lenses, with a bright rim where the glass is thinnest. The pointer is one more drop: bring it near the others and they neck and merge.

The prompt

Written for the variant you picked above: Clear

Write a WebGL1 fragment-shader background of clear glass metaballs over a printed pattern. The print: a paper colour with two soft colour bands that wander in y, fine diagonal hairlines (smoothstep on sin((x+y)·150)) and a dot grid — detail fine enough that refraction is obvious. The drops: six balls passed as a uniform vec3 array (xy in aspect space, z radius): five drift on slow, unrelated sine orbits computed in JS, and the sixth follows the pointer (eased) and grows from radius 0 when the pointer enters. The field is Σ r²/|p − c|², inside where it exceeds 1 (smoothstep 0.96–1.04 for an anti-aliased edge), and its analytic gradient is summed in the same loop. Let e = 1/f; its slope (−∇f/f²) is the lens: offset the print lookup by −slope × 0.035, sampling red, green and blue at slightly different strengths for dispersion, and tint the glass more where it is steep. Add a Fresnel rim (steepness³) and a directional highlight, and a faint contact shadow on the print outside the drops (the field sampled at a small down-right offset). Because the field is additive, drops neck and merge as they approach each other, the pointer included. Render at device resolution capped at 1× (0.8× on touch), stop frames offscreen or in hidden tabs, and draw one still frame under reduced motion. Colours are a prop: [paper, ink, band 1, band 2, glass tint]. Selected variant — Clear: Colours [#f3efe6 paper, #1b1a17 ink, #7c5cc4 band, #d9733a band, #dfe9f2 tint]: light paper print, violet and orange bands; overlay text dark (#1b1a17).

Notes

Interaction
Your pointer becomes a glass drop; push it into the others and they merge, then pull it away to watch them neck and part.
Motion
Drops orbit on 10–20s sines; the pointer drop eases at 12% per frame and grows in over about a third of a second.
Accessibility
The canvas is aria-hidden and decorative. Reduced motion draws one still frame.
Responsive
Drops are sized in height units and grow slightly on portrait screens so a few stay in view.
On touch
No pointer drop on touch; the five drops keep drifting and merging.

Featured

301 components