05

Mesh Drift

Four soft gaussian blobs, one per palette colour, orbit on mismatched sine paths and run in reverse. A light fbm domain warp bends the field so their edges smear into one another like ink in water, and the cursor gently swirls the space around it.

gaussian blobsfbm warpswirl cursor
Live

Installation

Add it to your project

$
pnpm dlx shadcn@latest add https://funshader.com/r/mesh-drift.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 { MeshDriftShader } from "@/components/shaders/mesh-drift/mesh-drift-shader";

export function Hero() {
  return (
    <section className="relative isolate min-h-svh overflow-hidden">
      <MeshDriftShader 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[]["#10002B", "#5A189A", "#9D4EDD", "#E0AAFF"]Palette, low → high. Hex strings or 0–1 RGB triplets, up to 8.
speednumber-0.57Multiplier on elapsed seconds.
scalenumber1.62Zoom. Higher values show more of the field.
intensitynumber0.37Spread.
paramAnumber0.33Shader-specific parameter.
warpnumber0.28Amount of organic domain warp.
detailnumber2.98Frequency of the warp noise.
contrastnumber1.08Colour grade: contrast.
brightnessnumber0Colour grade: brightness offset.
saturationnumber1Colour grade: saturation.
huenumber0Hue rotation in radians.
vignettenumber0.32Edge darkening, 0–1.
blurnumber0.007Soft 5-tap blur radius.
grainnumber0.1Film grain amount.
seednumber2812Noise seed.
rotationnumber1.64Field rotation in radians.
driftnumber0.18Slow positional drift.
oklabbooleantrueBlend palette colours in OKLab.
offset[number, number][0.2,-0.05]Pans the field.
cursorPartial<ShaderCursor>{"effect":"swirl","strength":0.2,"radius":0.46,"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