Tree generator

 from Red Blob Games
6 Jun 2022

This is a Javascript port of a Flash project I wrote in 2011[1], which no longer runs in a browser but still runs in the standalone Flash player. I tweaked it a bit after porting the code.


Size:

The basic idea is to create the tree structure through recursion. Start with a trunk and then spawn several branches. At the end of each branch spawn several more branches. Then draw a leaf cluster at the end of each of these branches, including the intermediate ones. A leaf cluster is just a few green circles.

If you want to dig deep into recursion for tree and plant generation, see the book Algorithmic Beauty of Plants[3] [PDF].

Email me , or tweet @redblobgames, or comment: