Falling Leaves in Autumn – Week 2

Concept

I’ve always enjoyed traveling to Europe during autumn. The sight of trees with almost yellow leaves fills me with a sense of calm and nostalgia. As I walk through parks and streets, the leaves gently falling to the ground create a serene atmosphere. Inspired by this, I decided to simulate the motion of falling leaves in my sketch. I wanted to capture how some leaves fall straight down due to gravity, while others drift to the right or left because of the wind. My goal was to recreate this natural motion using code, focusing on how gravity and wind impact the leaves’ movement.

Video Inspiration

I had initially hoped to use a video I took during my travels, but I couldn’t find one. So, I searched online and found a video that inspired this design.

Highlight of the Code

One part of the code I’m particularly proud of is how I simulate the wind and gravity forces. In the sketch, each leaf is given a slight variation in fall speed, which makes their movement feel more natural. Here’s a snippet:

 
// Loop through all the leaves and apply forces, update positions, and display them
for (let leaf of leaves) {
  // Apply gravity force to the leaf (fallSpeed controls how fast it falls)
  leaf.applyForce(createVector(0, leaf.fallSpeed * 0.1)); 
  
  // Random wind strength to add lateral movement (drift) to the leaf
  let windStrength = random(0, 0.05); 
  // Apply wind force in the direction determined by the leaf's drift
  leaf.applyForce(createVector(windStrength * leaf.drift, 0));

In this section, I applied gravity (downward force) and wind (side-to-side force) to each leaf. The random factor in wind strength and leaf drift direction gives the scene a more dynamic and organic feel.

Embedded Sketch

Reflection and Ideas for Future Work

Working on this sketch was both fun and calming. I was able to simulate the movement of the leaves quite effectively using acceleration, gravity, and wind forces. In the future, I’d love to add more interactivity to this simulation. For example, the wind could change based on mouse movements, or the leaves might react differently depending on where they fall. Another idea is to vary the leaf shapes or introduce different weather elements, like rain or snow, for a more complex autumn scene.

P5.js Full Code and Sketch

https://editor.p5js.org/maryamalmatrooshi/sketches/8tY74Enmr

Leave a Reply

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