Backgrounds

Stipple

A flowing luminance field crushed to ink and paper by error diffusion — each cell's quantization error is pushed onto its unvisited neighbours in a serpentine scan, so mid-tones resolve into the organic scattered grain of a stippled engraving instead of a fixed lattice. Atkinson forwards only three-quarters of the error, which is why the classic-Mac look keeps its blown highlights; Floyd–Steinberg and Sierra spread all of it for a smoother ramp. The field is diffused on the CPU into an ImageData at one cell per CSS pixel-group, then scaled up with smoothing off, so the grid survives retina intact.

Install

# Stipple needs no npm packages

Then copy 2 files into your project:

  • components/registry/stipple/stipple.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
algorithm"atkinson" | "floyd-steinberg" | "sierra""atkinson"Error-diffusion kernel. Atkinson drops a quarter of the error for punchy highlights; Floyd–Steinberg is the textbook 4-tap spread; Sierra pushes across three rows for the smoothest grain.
pixelSizenumber4CSS pixels per dither cell. The grid is measured in CSS pixels so a retina screen doesn't silently halve the cells.
fieldScalenumber2Spatial scale of the underlying luminance field.
speednumber0.25Flow speed of the field. Zero freezes the pattern without blanking it.
contrastnumber1.1Contrast curve applied around mid-grey before quantization — low values are all grain, high values are all shape.
serpentinebooleantrueAlternate the scan direction per row. One-way scans drag directional worm artifacts across flat regions; the boustrophedon hides them.
inkstring (hex)"#c4b5fd"The quantized on tone.
paperstring (hex)"#0b0812"The quantized off tone.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Stepped animation
An animation that is divided into discrete steps, like a countdown timer.

Related Components

Appears In