Concept
For this week’s assignment, I did not specifically want to simulate a real-life system but rather focus on creating an interesting visual piece. As instructed, I started from the dynamic flocking system as the base. I experimented with different values of distances for separation, cohesion, and alignment. I wanted to create something more chaotic than the base: I wanted the cohesion to be stronger, and alignment to be less prominent. In general, I wanted the flocking to be more aggressive if that makes sense. Although I experimented without a goal to mimic a particular system, the end result sort of reminds me of fireworks at certain stages. Here is the sketch:
Implementation:
The most altered part from the base was the show function. In the show() method, the visual effect is achieved by manipulating the ‘pulsation’ variable, creating a dynamic look for each element. The dynamic size of the circles is based on a sine function. Additionally, I added a fading trail effect by initializing a trail list for every boid, and storing the last 15 previous positions as vectors and constantly updating them (I created an extended class so that I would not mess up the base too much, and at some point the boids reminded me of fireflies so that’s where the naming comes from).
show() { // manipulating pulsation and alpha value let glow_size = 1 + 10 * sin(this.pulsation / 1.2); let alpha_value = map(glow_size, 1, 10, 100, 200); // drawing the trail for (let i = 0; i < this.trail.length; i++) { let trail_alpha = map(i, 0, this.trail.length, 0, 180); // Fade out the trail fill(255, 255, 200, trail_alpha); ellipse(this.trail[i].x, this.trail[i].y, glow_size, glow_size); } // Draw the current firefly noStroke(); fill(255, 255, 25, alpha_value); ellipse(this.position.x, this.position.y, glow_size, glow_size); // Update pulsation for the next frame this.pulsation += this.pulsation_speed; // updating the trail array this.trail.push(createVector(this.position.x, this.position.y)); if (this.trail.length > 15) { this.trail.shift(); // keeping the trail length limited } }
Improvements
If I were to follow the fireworks theme as my inspiration, I think switches in colors would be an interesting field of exploration. Perhaps it would even be possible to make the flocking orientated more toward the vertical path and create a firing-like effect . Additionally, I believe another direction could be taking inspiration from specific microorganisms and creating a more defined system that stabilizes a little more over time.
what I meant when I said that I was reminded of fireworks: