Ripple Pond

A procedural 2-D wave canvas. Clicks and hover inject amplitude at the cursor; waves propagate and interfere until they decay.

ByMihirJaiswalUpdated

Still waters

click · drag · hover

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

PropTypeDefaultDescription
cellSizenumber4Simulation cell size in pixels. Lower = finer waves + more CPU.
strengthnumber18How strong each click/hover is.
dampingnumber0.985Energy retained per frame. 1 means waves never decay.
ripplesOnHoverbooleantrueFire a smaller ripple on mousemove in addition to click.
rainbooleanfalseDrop ambient droplets at random so the surface moves on its own.
colorstringsky blueAny valid CSS colour for the lit wave crests.
backgroundstringcard toneAny valid CSS colour for the pond background.
classNamestring—Extra classes on the canvas element.