Backgrounds

Caustics

Light through moving water. The filaments are the zero crossings of a noise field folded back on itself, not its peaks — which is why they stay thin and hard-edged at any brightness instead of blooming into blobs. The lattice is periodic, so the flow offset wraps and the motion never coarsens over a long session.

Install

bun add ogl

Then copy 2 files into your project:

  • components/registry/caustics/caustics.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
scalenumber4Noise cells across the frame. Low values give a few slow, room-sized sheets of light; high values pack the frame with a fine mesh that starts to read as texture rather than as water.
speednumber0.35How fast the field flows. At 0 the pattern holds still and stays a legible backdrop; the loop keeps running, so the pointer still pushes it.
depthnumber3Octaves contributing to the network. Each one costs a full warped noise lookup, so this is the performance knob. Contribution falls at the same rate frequency climbs, so adding an octave adds detail without brightening the frame.
ripplenumber3.2Exponent on the folded ridge. This is what separates caustics from clouds: raising it thins the filaments and concentrates the light into them without softening an edge, which no brightness threshold can do.
refractionnumber0.85How far the field is displaced through a copy of itself before folding. At 0 the network is a fixed pattern sliding past; the branching and reconnecting people read as water is entirely this.
brightnessnumber1.35Gain on the filaments. Above 1 the ramp starts reaching its second stop, so the cores take the glow colour and the network gains a hot centre rather than simply getting paler.
pointerInfluencenumber1How far the pointer pushes the field. Smoothed toward the cursor rather than tracking it exactly, so a jumped pointer never snaps the whole network sideways.
inkColorstring (hex)"#a855f7"Body of a filament — the colour the network reads as.
glowColorstring (hex)"#e9d5ff"Core of a filament, reached only where the light concentrates past full. Two stops rather than one: a single ramp toward one bright colour flattens the network into a wire diagram.
backgroundColorstring (hex)"#08050e"The water itself. Its own material rather than a themed surface — a full-bleed background that flips to white under a light theme is not a background, it is a flash.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Float
A gentle, continuous up-and-down drift that makes a static element feel alive and weightless.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Hover effect
Visual change when the cursor moves over an element.
Hardware acceleration
Animating transform and opacity lets the GPU keep motion smooth.
Reduced motion
Respecting the user's prefers-reduced-motion setting by toning down or removing motion.

Related Components

Appears In