WP2WS W02 Generative Visuals with Forces

The Tree and the Glowworm

Link to the Live Site

Link to the Code

Demo

 

Inspiration

I’m inspired by Dan Shiffman’s tutorial on making a recursive tree. I wanted to make a tree that has branches and leaves that react to wind forces. 

Process

I started by following this tutorial to create a class for the branch. I had some problem 

The tree grew infinitely:

 

I was stuck here for a long time because I already set the if statement to let the program stop when the length of the branch is smaller than 10.

I console.log the distance between the new end&start point and found that the distance never gets smaller than 10. Therefore, I increased the threshold to 50. And the tree stopped growing infinitely:

 

Then, I tried to find a way to apply the wind force onto the branch’s objects. I first tried to

 

 

 

 

Reflection

 

Citation

  1. Coding Challenge #14: Fractal Trees – Recursive:

 

2. Coding Challenge #15: Object Oriented Fractal Trees

 

Leave a Reply

Your email address will not be published. Required fields are marked *