Power-User Systems

Ripple Field

A pool of dark, moonlit water you disturb by hand — a leapfrog solve of the 2D wave equation runs on a ping-ponged float field, ringing every pointer move outward, reflecting the swell off the walls, and lighting the surface with gradient-normal refraction, curvature-focused caustics, and a Fresnel glint riding each wavefront.

Install

bun add ogl

Then copy 2 files into your project:

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

Props

PropTypeDefaultDescription
waterColorstring (hex)"#F7FAFF"Amethyst tint of the water — specular glints, caustics, and crest light.
deepColorstring (hex)"#1227E1"Deep pool base color the surface sits over.
quality"low" | "medium" | "high""medium"Simulation grid resolution. Higher is crisper and costlier.
tensionnumber0.35Wave propagation speed. Higher spreads ripples faster; the leapfrog solve caps below 0.5 to stay stable.
dampingnumber0.99Per-step energy retention — toward 1 the ripples ring on longer.
splatForcenumber1Displacement a pointer drag or ambient drop carves into the surface.
splatRadiusnumber0.03Size of the surface dimple under the pointer, in screen fractions.
refractionnumber1How strongly the surface slope bends the pool floor beneath the ripples.
specularnumber0.4Intensity of the specular and Fresnel glints on each wavefront.
glossinessnumber96Specular tightness — higher is a sharper, glassier highlight.
causticsnumber1.5Brightness of the caustic threads where converging wavefronts focus light.
autoRipplebooleantrueRandomly drop into the pool when idle so it never sits perfectly still.
grainnumber0Animated fine grain over the final image.

What It Demonstrates

Ripple
A circle expanding from the point of a tap, confirming the press.
Drag
Moving an element by grabbing it, often with momentum when released.
Loop
An animation that repeats, a set number of times or infinitely.

Related Components

Appears In