Wave Background — React Animated Background
Three layered sine bands sweeping over a tri-color gradient, rendered fully on the GPU via WebGPU.

Starting live preview
Usage
import { WaveBackground } from "@/components/WaveBackground";
export function Hero() {
return (
<section style={{ position: "relative", minHeight: "100dvh" }}>
<WaveBackground
speed={1}
amplitude={1}
frequency={2.5}
from="#020617"
to="#1d4ed8"
accent="#38bdf8"
{...{
interactive: true,
speed: 1,
amplitude: 1,
frequency: 2.5,
from: "#020617",
to: "#1d4ed8",
accent: "#38bdf8"
}}
/>
<div style={{ position: "relative", zIndex: 1, padding: "8rem 2rem" }}>
<h1>GPU effects, native React</h1>
</div>
</section>
);
}Implementation notes & API
Purpose: ambient full-bleed animated background; three layered sine bands over a tri-color gradient. GPU-only via WebGPU. Mount: absolutely-positioned or fixed layer behind content; canvas fills its parent, give the parent an explicit size. Props: speed (0-4), amplitude (0-2.5), frequency (0.5-6), from/to/accent hex colors. Pointer: moving the cursor sloshes the wave phase (x) and lifts the water level (y); interactive={false} pins the authored look. Guardrails: pass fallback for non-WebGPU clients; SSR renders an inert canvas; reduced-motion freezes automatically; do not stack multiple instances on one screen.
| Property | Type | Notes / default |
|---|---|---|
interactive | boolean | false in the library; enabled in this preview |
fallback | ReactNode | Shown when the renderer is unavailable |
className / style | string / CSSProperties | Applied to the outer container |
View source on GitHubFree for commercial projects · MIT