Skip to content

No.210 · 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

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

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 (clear): Colours [#f3efe6 paper, #1b1a17 ink, #7c5cc4 band, #d9733a band, #dfe9f2 tint]: light paper print, violet and orange bands; overlay text dark (#1b1a17). This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. 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 behavior: Drops are sized in height units and grow slightly on portrait screens so a few stay in view. Touch: No pointer drop on touch; the five drops keep drifting and merging. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

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.