Backgrounds

Chladni

Sand on a vibrating metal plate. Where the plate shakes, the grains jump away. Where it stays still, they settle, so the sand gathers on the still lines and draws a Chladni figure. Every few seconds the plate changes note and the sand dances into a new figure. Move the pointer over it to scatter the grains, like a violin bow.

Install

# Chladni needs no npm packages

Then copy 2 files into your project:

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

Props

PropTypeDefaultDescription
grainsnumber9000How many grains of sand sit on the plate.
complexitynumber6The highest note the plate plays. Higher notes draw finer figures.
dwellnumber4.5How long each figure holds before the plate changes note.
vibrationnumber1How hard the plate shakes the sand loose.
bowRadiusnumber90How far the pointer scatters the sand. 0 turns the bow off.
grainSizenumber1.5The size of one grain.
showNodesbooleanfalseDraw faint lines where the sand is heading.
grainColorstring (hex)"#e9d5ff"The sand.
plateColorstring (hex)"#0b0812"The metal plate under the sand.

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.
Hover effect
Visual change when the cursor moves over an element.
Morph
One shape smoothly turns into another shape, e.g. Dynamic Island.

Related Components

Appears In