Visualizations
215 / 500

215 · Math

SLE Curves

Random fractal curves grown tip first from Loewner's equation, kappa by kappa.

Schramm-Loewner evolution SLE(kappa) is the curve you get by feeding Loewner's equation a Brownian motion scaled by the square root of kappa, and it is the scaling limit of loop-erased walks (2), Ising interfaces (3), percolation hulls (6) and spanning tree paths (8). Each of 20,000 time steps is a vertical slit map with a closed form, and the zipper algorithm composes their inverses to find every new tip, so the curve grows live from the real line. Behind it, a lattice of points is pushed forward through every slit map, and marching squares draws the level lines of g_t: a square grid flowing around the curve. For kappa above 4 the curve touches itself and the line, and a flood fill over a rasterized copy finds each region it swallows and washes it in the ink of that moment.

Try it. Drag the kappa slider and release to regrow the same Brownian path at the new kappa, or press 1 to 9 or the arrow keys. Click for fresh noise, Space pauses, R replays. Left alone, it tours the famous values.

  • Loewner zipper algorithm
  • Conformal maps with complex square roots
  • Marching squares level lines
  • Flood fill hull detection

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 Schramm-Loewner evolution (SLE) curve generator 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, stays sharp on high-DPI screens, and draws the upper half plane: the real line near the bottom, the origin at its center.
- Build a driving function: W[0] = 0 and W[k] = W[k-1] + sqrt(kappa * dt) * (a standard normal sample), for N = 4,000 steps with dt = 0.4 / N. Start with kappa = 6.
- Hold W constant on each step. The inverse Loewner map for step k is then f_k(w) = W[k] + sqrt((w - W[k])^2 - 4 dt), using complex arithmetic and always choosing the square root with a non-negative imaginary part.
- The tip after n steps is f_1(f_2(...f_n(W[n]))): start at the real number W[n] and apply the maps from k = n down to 1. That is the zipper algorithm.
- Each animation frame, compute a few dozen new tips and draw the curve as a polyline, so it grows tip first from the origin.

Once that works, make it beautiful:
- Draw it like ink on paper: a warm paper background, a dark ink line whose color shifts with the time each point was born, and a glowing drop at the tip.
- Add a kappa slider from 0 to 10. Keep the same normal samples when kappa changes, so the same random path regrows at the new kappa. Watch it go from simple (below 4) to touching itself (4 to 8) to filling space (above 8).
- Label the famous values: 2 is loop-erased random walk, 3 is the Ising interface, 6 is percolation, 8 is the uniform spanning tree.

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 drawing the conformal grid around the curve by pushing points forward through each step's map, shading the regions the curve swallows, or a radial version that grows inside a disk.
PreviousWave Function CollapseA tile-based world that assembles itself one consistent cell at a time. NextBokeh CameraA night street shot through a simulated lens, with polygonal bokeh and cat's eyes.

Related visualizations

  • Space-Filling CurvesMath Hilbert, Peano, Gosper and friends fold smoothly from one order to the next.
  • Inscribed SquaresMath Every closed curve hides a square? Draw one and watch the hunt (open since 1911).
  • Curve ShorteningMath A tangled island shrinks by its own curvature and leaves a topographic map behind.
  • Apollonian GasketFractals An endless packing of kissing circles, each engraved with its exact integer curvature.
  • IFS EditorFractals Sculpt fractals by dragging affine parallelograms while the chaos game redraws them.
  • Lyapunov FractalFractals Type a string of A and B and the logistic map grows gold and teal enamel jewelry.
  • Critical PercolationSimulation Open hexagons merge into a giant cluster the instant p crosses one half.
  • Droste SpiralType and image Escher's Print Gallery effect: a painted harbor town that spirals into itself forever.
  • Differential GrowthGenerative art One closed line grows, buckles and folds into brain coral without ever crossing.

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

← More from Emergent Mind Labs