Skip to content

No.214 · Backgrounds

Ripple Tank

A shallow tank of water running a real wave equation: move across it to leave a wake, click to drop a stone, and every ring spreads, reflects and bends the tiled floor from exactly where it started.

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: Ink

Build an interactive water background from a real 2D wave equation. Simulation (CPU): a heightfield grid at one cell per 5 CSS px, two Float32Arrays swapped each step, a Verlet step next = (2h − previous + 0.3 × L) × 0.993, where L is the isotropic 9-point Laplacian (4 × edges + corners − 20h) / 6 so rings stay round. Step at a fixed 8ms rate (catching up at most 5 steps a frame) so waves travel at the same speed on any display. Disturbances push a Gaussian disc down: the pointer leaves a wake along its path (samples every 1.5 cells, amplitude growing with speed), a click drops a stone (radius 2.6, amplitude 2.2), and when idle a small raindrop falls every 0.65–1.55s. Edges are fixed at zero, so rings reflect. Rendering (WebGL1): upload the heightfield each frame as a 16-bit value split across a LUMINANCE_ALPHA texture (high byte, low byte — 8 bits alone shows as grid noise in the shading) with LINEAR filtering, so a coarse grid renders smoothly at full resolution. In the fragment shader take central differences for the slope and a Laplacian for curvature. Draw a tile grid on the floor, displaced by the slope (refraction); brighten where the surface curves inward (light focusing) and darken where it spreads; add a specular highlight from a fixed light. Vignette and dither. Pause entirely offscreen or in a hidden tab. Under reduced motion, place three stones, advance 150 steps and draw one still frame. Colours are a prop [deep, floor, tile, highlight]; a light flag inverts the caustic shading so troughs darken instead of brighten on light grounds. Selected variant — Ink (ink): Colours [#05070b, #0f1724, #2a3a52, #cfe0ff], light=false: dark ink water with pale blue highlights. 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: Move across the surface to leave a wake; click or tap to drop a stone. Raindrops fall while you're idle. Motion: Wave equation at 125 steps/s with 0.993 damping; rings take about 3s to die away. Accessibility: The canvas is aria-hidden and decorative, with content above it. Reduced motion shows one still frame of settled rings. Responsive behavior: The grid follows the container size at 5px cells; rendering is capped at 1× DPR (0.75× on touch). Touch: Tap to drop a stone; dragging leaves a wake until the browser takes over the scroll. 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
Move across the surface to leave a wake; click or tap to drop a stone. Raindrops fall while you're idle.
Motion
Wave equation at 125 steps/s with 0.993 damping; rings take about 3s to die away.
Accessibility
The canvas is aria-hidden and decorative, with content above it. Reduced motion shows one still frame of settled rings.
Responsive
The grid follows the container size at 5px cells; rendering is capped at 1× DPR (0.75× on touch).
On touch
Tap to drop a stone; dragging leaves a wake until the browser takes over the scroll.