Back

My Fractal Tree 🌲

My Fractal Tree 🌲

image alt text

First check out my live Tree here 🌲
I want to share something beautiful I made last night that I was happy with 😊, it’s a drawing actually, and it’s perfect cause Ididn’t draw it using pencil.

I find it so interesting how you can create something so beautiful using your imagination and some tools.

Last night I stayed late watching some recursion art shapes I came across while browsing, there were some awesome examples that got my attention.

Recursive Art is mainly type of art that creates shapes using recursive functions.

For me it looked so satisfying and beautiful, I though I wanna try making a simple one, a tree.

A tree with trunk, branches and green leafs maybe ;)

Implementing it was fun and somehow easy, the idea is based on recursion, and in my tree each branch has atleast 2 branches so it’s a recursive function that calls itself, and maybe stop if reaches N level or depth.

A couple of challenges were:

  • how to adjust left branch and right branch angles to look realistic (not too perfect).
  • how to decrease thickness of branch as you go up.
  • varying color grades and varying number of branches
  • how to randomize the generation to be slightly different on every refresh

it was fun and the output amazed me given it took few hours, and here is the output: https://ahmedbassell.github.io/fractal_tree/

note: it gets generated slightly different each time you hit refresh

and you can check the code here: https://github.com/ahmedBassell/fractal_tree

image alt text

Please leave a comment if you have any thought about the topic

Thanks for reading ❤️