When I saw this week's assignment requirement, I was thinking about what I should do for "infinite patterns". I used to want to generate a physical endless pattern. But when I saw the tree outside and the sample code, I was inspired. (I have the idea to create a project related to tree for a long time). So I catch the opportunity ti create a dynamic and visually appealing recursive tree visualization.
Trees are full of vitality, they have both branches growing towards sky and rooting towards the depth of the earth. They looks like have ceartain height, but we actually don't know how deep it goes. Trees just stay there for thousands years, witnessing a lot of changes. They are strong, vital but also "alone" when facing long the history. Tree deserve us to explore as a artistic concept. Here, we can say that tree has "infinite" roots, life and vitality.
The tree is composed of two main fractal systems: the branches growing upward and the roots expanding downward, representing where the tree comes from and where it would go. To enhance interactivity and customization, I implemented a user interface using Tweakpane, which allows users to modify elements such as branch angle range, root bifurcation probability, tree scale, leaf color, and leaf shape. The tree includes a growth animation, where the structure gradually emerges over time, controlled by a growthProgress variable.
The recursive logic for branches and roots shares a similar approach but diverges in style: branches grow using simple straight lines, while roots incorporate a segmented, slightly curved form to give them a more organic appearance(because when I tried to use the same method, I found the roots were a bit strange). This was achieved using sine wave perturbations along interpolated line segments. I also included three types of leaf shapes, which are classical, round, and pointy. Each type of the leaves rendered with its own geometry. A regeneration button resets the seed and starts a new tree generation, offering a unique structure every time. The GUI design was thoughtfully arranged in folders with labels and sliders for better user experience.
Through building this project, I gained a deeper understanding of recursive algorithms, parameter-based generative art, and how to organize interactive sketches using Tweakpane. One of the most valuable lessons was how to balance randomness with control. I adjust the value and range many many times to allow the tree to appear natural and varied while still maintaining design coherence. I learned how to simulate realistic wind effects on leaves using trigonometric functions, and how to prevent unintended motion in the rest of the tree. Debugging the root disappearance issue also helped me understand the importance of timing and depth constraints in recursive visual growth. (It really takes me a long time to figure out how to realize the effect I want!)
Moreover, I became more familiar with the GUI setup and the drawing logic, which helped keep everything maintainable and scalable. I also explored how different visual styles can be created through small variations in geometry. If I have more time, I want to add more function to the leaves and let them naturally sway, and furthermore, be controlled by the uses through GUI. I tried this time, but I struggle for about two hours and regrettably failed, so I changed my straetgy to make the growing animation. Overall, this project gave me an opportunity to finish a project themed with trees which I want to do, and letting me learn fractal and recursive methods for building generative systems that are both interactive and visually rich.