Visualizations
170 / 500

170 · Simulation

Drying Mud

Wet clay dries and cracks into a lakebed of curling plates, primaries first.

The clay is a disordered triangular lattice of springs, each node also tied to the ground by a weak spring, and as a node dries its springs want to be shorter. The ground holds the sheet in place, so tension builds until the most overstressed springs break, a few at a time and spaced apart, while drying pauses until each avalanche of breaks settles. Stress gathers at the tip of every break, so cracks run, and later cracks grow into the relaxed zones beside older ones and stop when they meet them, giving T junctions and a hierarchy of wide primary cracks around thinner secondary ones. Layer thickness sets the ratio of in-plane stiffness to the ground's grip, which sets the plate size: thin layers flake into small curls and thick ones break into slabs. Cracks are drawn on the dual lattice, traced into chains, smoothed, and widened by how far each broken spring has pulled apart.

Try it. Drag to rewet the clay with a brush; healed cracks stay a little weaker, so the patch tends to crack again along its old lines. Keys 1 to 5 (or up and down) pour a fresh layer of a different thickness, space brings a rain shower, and R pours fresh mud.

  • Spring lattice fracture
  • Gauss-Seidel relaxation
  • Quasi-static loading
  • Union-find
  • Dual graph rendering

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a drying mud crack simulation with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a canvas that fills the window and stays sharp on high-DPI screens.
- Lay out a triangular lattice of nodes about 10 pixels apart, each jittered a little at random, and connect neighbors with springs. Give each spring a rest length and a random breaking strain around 3%, and tie every node to its starting position with a weak spring (the clay sticks to the ground).
- Give every node a moisture value that starts at 1 and slowly drops. As the clay dries, shrink each spring's rest length by up to about 15%.
- Each frame, relax the lattice with a few Gauss-Seidel sweeps: move every node to the weighted average of where its springs and its ground spring want it.
- Then break the few springs stretched furthest past their strength, never two close together, and draw every broken spring as a short dark line across it.

Once that works, make it beautiful:
- Draw cracks on the dual lattice: a broken spring becomes the segment between the centers of the two triangles beside it, and its width is how far the spring's ends have pulled apart.
- Trace connected broken springs into chains and smooth them, so cracks read as curves instead of zigzags.
- Paint a mottled silt texture, darken it where still wet, and give crack edges a light rim on the sunny side and a shadow on the other, so the plates look raised and curled.
- Let the stiffness ratio (the layer's thickness) be adjustable and watch the plate size change.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a brush that rewets and heals the clay, letting plates lose their grip on the ground late in drying so gaps open wide, or counting plates with union-find.
PreviousBorsuk-Ulam WeatherA topology theorem guarantees two antipodes share the weather. Watch them get found. NextHybrid ImagesOne picture, two subjects: an owl up close, a cat from across the room.

Related visualizations

  • KintsugiGenerative art A glazed tea bowl shatters along branching cracks, then is mended with flowing gold.
  • Basalt ColumnsNature Cooling lava cracks into columns that drift toward hexagons, on an isometric causeway.
  • Shattered PanePhysics A sunny window breaks into radial and ring cracks, then shards tumble and glint.
  • Rotating DrumPhysics Grains in a turning drum avalanche and sort themselves: big outside, small in the core.
  • Chladni PlateSound Sand dances into Chladni figures on a brass plate whose modes come from the Ritz method.
  • DendritesSimulation Supercooled melt freezes into branching dendrites, with latent heat glowing between arms.
  • Tearable ClothPhysics A sheet of Verlet points and springs that sags, swings and rips.
  • Falling SandSimulation Sand, water, fire, lava and plants that all react with each other.
  • Snow and SlushPhysics Snowballs, jelly, sand and water smash and tumble down a slope, simulated with MLS-MPM.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs