Chapter 02 - Lesson 08
Wind and Animation
Use time-based sway to make the tree feel alive.
Concept explanation
Animation changes parameters over time. A sine wave can nudge each branch angle so the tree sways. This is visual simulation, not full physics.
Try it
Use time-based sway to make the tree feel alive.
Code fragment
const sway = sin(time + level * 0.7) * windStrength;
rotate(baseAngle + sway);
What to observe
- Low wind reads as a gentle breeze.
- High wind can make recursion harder to follow.
- Pausing helps compare animated and static forms.
Small challenge
Find the strongest wind setting that still keeps the branches legible.