Sections / Gems / Generative backgrounds

Caustics

Sunlight through moving water, thrown on the wall behind your hero in your own three colours. The light is worked out from the curvature of a seeded water surface, so the bright filaments gather, split and re-form the way real pool light does, with a hint of colour at their edges. The pointer drops rings into the water that bend the light as they spread. One small WebGL shader, no dependencies.

Free
Open the demo
Caustics: six frames of the gem in motion
Kind
Generative backgrounds
Interaction
autoplay · pointer rings · generative · WebGL · pause button · seeded
Dependencies
None
Licence
Free for personal and commercial sites; do not resell the gem itself

Formats

  • Webflow (native)
  • Figma (layers)
  • Framer component
  • HTML
  • Prompts for Claude Code, Cursor, Lovable, v0, Bolt

Copy to Webflow pastes a native section with the gem in an Embed inside it. Copy to Figma pastes a frame of its best moment, text and controls as layers. Copy to Framer pastes a component with its options as controls. HTML is one self-contained snippet. Each prompt (Claude Code, Cursor, Lovable, v0, Bolt) carries the exact files, so your agent installs this gem, not a lookalike. With the MCP server, ask your agent for get_section("caustics").

Behaviour and accessibility

  • The same seed always gives the same water, so the light looks the same on every visit and every device.
  • A labelled pause button (aria-pressed) stills the water for anyone who wants stillness; the water itself is decorative and hidden from screen readers.
  • Drawing stops entirely off screen or in a background tab; the light renders at a capped pixel count and the browser scales it up, which the soft pattern does not show.
  • With prefers-reduced-motion: one still frame, no colour split, no rings and no pause button. Without WebGL it falls back to a still gradient in the same colours.
  • Anything you put inside the element (a headline, buttons) sits above the water in a .cst-content layer.

Options

OptionTypeDefaultWhat
palette[string, string, string]3 built inThree colours: the deep water, the lit wall, the caustic light.
scalenumber150Size of the pattern: px per light cell, roughly. Bigger is calmer.
focusnumber1How hard the water focuses the light. 1 is clear summer water; lower is softer, higher is sharper.
dispersionnumber0.35Colour split at the bright filaments. 0 turns it off.
speednumber1Time scale: 1 is a slow swell, 2 twice as fast.
pointerbooleantrueThe pointer drops rings into the water (mouse and pen).
controlsbooleantrueShow the pause button.
seednumber3Seed for the waves: the same seed gives the same water.
onPause(paused: boolean) => voidCalled when the water is paused or played with the button or the handle.