Skip to content

Dither waves

Playground

Move cursor over canvas to interact

Variant

Mode

Matrix Algorithm

Pointer repulsion

Install

npm install @shavin/fx
import { DitherWaves } from "@shavin/fx";

Works with

React

Client component; Next.js and any React 18+ app

Remotion

Frame-exact through FxTimeProvider or time

Anatomy

import { DitherWaves } from "@shavin/fx";

<DitherWaves
  colors="theme"
  speed={0.25}
  frequency={1.6}
  amplitude={0.5}
  intensity={1.0}
  matrix="8x8"
  interactive={true}
  className="h-96 rounded-[var(--radius-panel)]"
/>

Examples

Theme palette

With colors set to theme, the waves take the brand colour and follow light and dark mode.

Component Source
<DitherWaves
  colors="theme"
  speed={0.2}
  frequency={2.8}
  amplitude={0.3}
  intensity={3.2}
  className="h-64 rounded-[var(--radius-panel)]"
/>

Monochrome

With colors set to native, the waves are slate ink: light on dark in dark mode, dark on light in light mode.

Component Source
<DitherWaves
  colors="native"
  speed={0.15}
  frequency={3.5}
  amplitude={0.4}
  matrix="8x8"
  className="h-64 rounded-[var(--radius-panel)]"
/>

Coarse 4x4 matrix

The 4x4 Bayer matrix has 16 threshold levels, so the dither pattern is coarser than the 8x8 default.

Component Source
<DitherWaves
  colors="brand-dark"
  speed={0.3}
  frequency={4.0}
  amplitude={0.5}
  matrix="4x4"
  className="h-64 rounded-[var(--radius-panel)]"
/>

Halftone dots

With mode set to halftone, round dots on a grid are sized by the wave value.

Component Source
<DitherWaves
  mode="halftone"
  cell={14}
  colors={["oklch(0.82 0.12 230)", "oklch(0.1 0.02 260)"]}
  intensity={1.1}
  className="h-64 rounded-[var(--radius-panel)]"
/>

Pixel tiles

With mode set to pixels, rounded tiles are coloured by the wave value, warming to white at the peaks.

Component Source
<DitherWaves
  mode="pixels"
  cell={28}
  colors={["oklch(0.62 0.22 30)", "oklch(0.96 0.01 260)"]}
  frequency={1.2}
  className="h-64 rounded-[var(--radius-panel)]"
/>

Props

PropTypeDefaultDescription
colorsFxPalette: "theme" | "native" | "brand-dark" | "brand-light" | string[] | { light: string[]; dark: string[] }"theme"Palette. "theme" follows the brand and light/dark; "native" is monochrome slate ink; "brand-dark" / "brand-light" force one side; an array is a custom [waveColor, bgColor] pair.
color"theme" | "monochrome" | "brand-dark" | "brand-light" | string[]—Deprecated: use colors ("monochrome" is colors="native").
speednumber0.25How fast the waves flow.
frequencynumber1.6Spatial frequency of the waves; higher packs more waves in.
amplitudenumber0.50How far the waves distort.
intensitynumber1.0Contrast and colour intensity multiplier.
mode"dither" | "halftone" | "pixels""dither"Ordered dithering, round halftone dots sized by the wave, or rounded tiles coloured by it.
cellnumber14Grid cell size in CSS px for halftone and pixels.
matrix"8x8" | "4x4""8x8"Bayer matrix for dither mode: 8x8 is fine, 4x4 is coarse.
interactivebooleantrueThe pointer pushes the waves aside (mouse, touch and pen). Ignored under reduced motion.
mouseRadiusnumber0.3Radius of the pointer's influence, relative to the canvas height.
timenumber—Controlled time in seconds (e.g. frame / fps in Remotion): draws exactly this moment, no clock of its own. Also read from FxTimeProvider.
Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font