Amal – Assignment 2

Inspiration

Concept

For this assignment, I chose to simulate the movement of a moth attracted to a lamp, inspired by how insects behave around light sources in nature. When observing moths, their motion is rarely direct or smooth; instead, it feels hesitant, wobbly, and slightly chaotic.

The goal of this sketch was to recreate that behavior using only acceleration-based forces, without relying on complex visuals. The personality of the moth comes entirely from how it moves rather than how it looks.

The lamp acts as a constant attractor, while a subtle wobble force gives the moth an organic, fluttering quality.

Code Highlight

The part of the code I am most proud of is the wobble (flutter) force, which adds personality to the moth’s movement without making it feel random:

this.wobble += 0.1;
let flutter = createVector(
  cos(this.wobble),
  sin(this.wobble)
);
flutter.mult(0.03);
this.applyForce(flutter);

This small oscillating acceleration creates a natural, insect-like flutter. Combined with the attraction to the lamp, it makes the moth feel alive and slightly unpredictable, rather than robotic. And, this is where I used ChatGPT’s to help.

The Code

Reflection & Future Work

This project helped me better understand how simple rules can create believable natural motion. Using acceleration alone forced me to think carefully about how each force affects the behavior over time.

What worked well:

  • The combination of attraction and wobble felt natural and readable.
  • Limiting speed and force helped keep the movement smooth.
  • Keeping visuals simple allowed the motion to stand out.

If I were to continue developing this sketch, I would:

  • Add a “panic zone” near the lamp where the moth starts circling instead of approaching directly.
  • Introduce multiple moths with slightly different parameters to give each one a unique personality.
  • Experiment with a pulsing or moving light source to see how the behavior adapts.

One thought on “Amal – Assignment 2”

  1. I love this! simple code and a really strong concept.
    I was wondering if you can have more flies and how it would look like.

Leave a Reply to Afra Binjerais Cancel reply

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