Draw My Canvas / studio

Fractal Dreams

A branching L-system tree swaying toward ever finer depth.

Plate 08L-system
Live on an HTML canvas · vanilla JavaScript · no dependencies Open fullscreen

About this piece

Fractal Dreams grows a recursive tree. Start with one trunk; at its tip, split into two branches angled left and right; shorten each by about a third; then do the same thing again at every new tip. Repeat eight levels deep and a single line becomes a full canopy — the essence of an L-system, the grammar botanists use to model plants.

The rule is only a few lines of code, but because it calls itself the detail multiplies with every level: 2 branches, then 4, then 8, all the way to hundreds of twigs. That is self-similarity — zoom into any branch and it looks like a small copy of the whole tree.

What to look for

A single global sway value, driven by a slow sine, bends every branch angle at once, so the whole tree breathes like it’s caught in a light wind.

Ink and line-width are keyed to depth — thick cobalt near the trunk fading to thin coral at the tips — which reads as distance and makes the canopy feel three-dimensional.

Curious how the loop and canvas fit together? Read how it works →