Backgrounds

Moire

Two lattices stacked at a fraction of a degree apart, beating against each other into live interference fringes. Every layer is band-limited in the shader, so what you see is the interference and not the sampling.

Install

bun add ogl

Then copy 2 files into your project:

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

Props

PropTypeDefaultDescription
lattice"lines" | "grid" | "dots" | "rings""lines"Shape of the two stacked layers. Lines beat into banding, grid into a woven plaid, dots into a rosette, rings into a bullseye that walks as you move.
pitchnumber9Spacing of one lattice cell, in CSS pixels. Widen it and the beat frequency drops — the fringes get broader and travel slower even though nothing else changed.
anglenumber3.2Rotation between the two layers. This is the whole effect: at 0° they stack invisibly, and a tenth of a degree either side sweeps the fringes across the entire field.
driftnumber0.35How far the angle and offset breathe on their own. 0 holds one still interference pattern, which is the honest setting to put behind body copy.
separationnumber6Offset between the layers — a second beat axis independent of angle, so the fringes shift without rotating.
thicknessnumber0.16How much of a lattice cell is ink. Kept low by default so the field stays dark enough to put content on; push it past 0.5 and the two layers cover almost everything, which is a wall rather than a background.
contrastnumber1How hard the fringes clip toward light and dark, expanded around the pattern's own mean rather than mid-grey. Above about 1.6 the soft beat becomes hard banding.
pointerInfluencenumber1How much the cursor twists and shifts the top lattice. 0 leaves a field that ignores you entirely.
inkColorstring (hex)"#a855f7"Amethyst of the lattice lines themselves.
backgroundColorstring (hex)"#08050e"The dark field the two lattices sit on.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Rotate
Spin an element around a point.
Hover effect
Visual change when the cursor moves over an element.
Hardware acceleration
Animating transform and opacity lets the GPU keep motion smooth.
Linear
Constant speed. Avoid for UI; reserve for spinners or marquees.

Related Components

Appears In