04

Waves

A vertical palette ramp is rippled by a travelling sine wave and roughened with fractal noise, so the bands roll like a swell seen from above. A tidal blue palette is hue-rotated into acid chartreuse, and the cursor opens a lens that pushes the waves aside.

sine bandsfbmlens cursor
Live

Installation

Add it to your project

$
pnpm dlx shadcn@latest add https://funshader.com/r/waves.json

Installs 5 files into components/shaders. The engine is shared, so a second shader only adds its own three files.

Usage

Mount it behind your content

app/hero.tsx
import { WavesShader } from "@/components/shaders/waves/waves-shader";

export function Hero() {
  return (
    <section className="relative isolate min-h-svh overflow-hidden">
      <WavesShader className="-z-10" />
      {/* your content */}
    </section>
  );
}

The shader fills its nearest positioned ancestor. Give the parent relative isolate and the shader -z-10 to put it behind everything else. The cursor is tracked on the window, so content on top doesn’t block it.

API reference

Props

PropTypeDefaultDescription
colorsShaderColor[]["#031C26", "#1B6CA8", "#5AD2F4", "#EAF9FF"]Palette, low → high. Hex strings or 0–1 RGB triplets, up to 8.
speednumber1.33Multiplier on elapsed seconds.
scalenumber1.16Zoom. Higher values show more of the field.
intensitynumber0.76Swell.
paramAnumber0.46Shader-specific parameter.
warpnumber0.03Amount of organic domain warp.
detailnumber1.66Frequency of the warp noise.
contrastnumber0.91Colour grade: contrast.
brightnessnumber0.06Colour grade: brightness offset.
saturationnumber1.08Colour grade: saturation.
huenumber1.5Hue rotation in radians.
vignettenumber0.36Edge darkening, 0–1.
blurnumber0.007Soft 5-tap blur radius.
grainnumber0.02Film grain amount.
seednumber4892Noise seed.
rotationnumber3.39Field rotation in radians.
driftnumber0.15Slow positional drift.
oklabbooleanfalseBlend palette colours in OKLab.
offset[number, number][-0.21,0.11]Pans the field.
cursorPartial<ShaderCursor>{"effect":"lens","strength":0.36,"radius":0.63,"follow":"direct"}Pointer effect: push, lens, swirl, ripple, glow or none.
pausedbooleanfalseFreezes the current frame.
maxDprnumber2Cap on devicePixelRatio.
respectReducedMotionbooleantrueDraws a still frame for prefers-reduced-motion.
classNamestring—Classes for the absolutely-positioned wrapper.

Keep exploring

More shaders