Ripple Pond is a React canvas component that runs a classic 2-D water simulation — every cell each frame becomes the average of its four neighbours minus its previous value, damped. Clicks splat a strong impulse, and (optionally) hover sprinkles a softer one; waves interfere, reflect off the edges, and decay over time.
Cell size trades fidelity for CPU; the defaults are tuned for a smooth 60 fps on mid-range laptops at typical hero-section sizes.
Installation
Usage
import { RipplePond } from "@/components/ui/ripple-pond";
export function Example() {
return (
<div className="h-80 w-full overflow-hidden rounded-xl">
<RipplePond />
</div>
);
}Calmer, clicks only
<RipplePond cellSize={8} strength={10} ripplesOnHover={false} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
cellSize | number | 4 | Simulation cell size in pixels. Lower = finer waves + more CPU. |
strength | number | 18 | How strong each click/hover is. |
damping | number | 0.985 | Energy retained per frame. 1 means waves never decay. |
ripplesOnHover | boolean | true | Fire a smaller ripple on mousemove in addition to click. |
rain | boolean | false | Drop ambient droplets at random so the surface moves on its own. |
color | string | sky blue | Any valid CSS colour for the lit wave crests. |
background | string | card tone | Any valid CSS colour for the pond background. |
className | string | — | Extra classes on the canvas element. |
