← All embers

Simple Fractal Tree

December 2020

Each click grew the tree one generation. Simple math, pure magic.

  • JavaScript
  • p5.js

An interactive fractal tree built with p5.js. Each click grows one generation of branches — every unfinished branch splits into a left branch rotated −PI/4 and a right branch rotated PI/6, each two-thirds its parent's length. Leaves sprout every couple of clicks, then drift and fall.

Starting from a single root branch, every click walks the tree and splits each unfinished branch in two. That one recursive rule is all it takes for a full fractal canopy to appear.

Every second click sprouts leaves at the branch tips, and as the tree matures they fall with a bit of randomness for a natural drift. After ten clicks the tree resets to a single root and you get to grow it all over again.

SPECTRE