Koi PondPro
A tiny living koi pond in WebGL. Three koi glide through deep, clear water inside a ring of mossy river stones, under a dithered pixel finish.
Preview
Open the component on its own page in a new tab ↗Usage
Drop it anywhere. It fills the width it is given and keeps a square shape.
import { KoiPond } from "@/components/ui/koi-pond"
export function Hero() {
return <KoiPond className="mx-auto max-w-xl" />
}The grass, water and stones are drawn into a small render target and then dithered, which gives
the pixel finish. Raise resolution for finer pixels, lower levels for a grittier dither; both
update live without rebuilding the scene.
<KoiPond resolution={240} levels={4} />The koi are drawn on top at full resolution so they stay crisp, while their shadows stay in the dithered pond so they sit on the floor of the water.
The settings button in the top-right corner opens a panel for the pixels, the dither and each
koi's base, patch and fin colors. Hide it with controls={false}.
What moves
- Three koi (orange and cream, white and red, gold and black) pick spots around the pond, keep clear of each other and the stones, and swim with a soft body wave and fluttering fins.
- Caustics ripple across the shallows, glints sparkle on the surface, and the stone ring casts a shadow into the water away from the light.
- Cherry petals drift on the surface, each with a faint shadow on the water.
With prefers-reduced-motion, a single still frame is drawn instead.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
resolution | number | 520 | Width in pixels of the dithered render. Lower is chunkier. |
levels | number | 10 | Color steps per channel for the dither. Lower is grittier. |
controls | boolean | true | Show the settings button and panel. |
className | string | — | Classes for the square wrapper. |