Serenity of the Firefly Class Redux
For my ICM final, I decided to upgrade my fireflies sketch to make it a more realistic and immersive experience. I wanted to alter the movement of the fireflies to mimic the swarming behavior of insects. To do this, I enhanced the firefly class and added a Flock class (based on Dan Shiffman’s Boid and Flock classes for Nature of Code). I also added a flash() function using a sinusoidal pattern to make the fireflies blink. The fireflies also dim when they approach the cursor, as they did in the previous version of the sketch. I used the Minim library to add audio for the sounds of crickets in a meadow. Visually, I added a moon and redesigned the fireflies to give them a little halo of light. The end result was quite mesmerizing.
The code is way too long to post here, but you can find all of it at its OpenProcessing page.
I’m currently working on an HD version of this program so that I can play it on my TV.