Nature of Code – Particles

This week’s assignment was to work with particle systems. In class we were able to build an emitter and a couple different types of particles. I wanted to try to create a few different types of particles that were attracted to particles of the same type. I also wanted to eliminate particles through merging rather than simply deleting them when they went off screen. Ultimately I was able to get three different color circles to randomly emit, attract to like colors, and form larger and larger merged particles. However I did have some difficulty implementing the prototyping method we learned beyond simple rendering changes. I think with more time I could significantly shrink the code.

I first moved the emitter around the screen and played with some of the properties. I was able to make some firework looking things pretty quickly.

Screen Shot 2016-02-23 at 6.02.28 PM

Once I refamiliarized myself with the code I set out creating three distinct types of particles (indicated by color). I implemented separate attraction gravity for each color.

Screen Shot 2016-02-23 at 10.41.34 PM

After wrestling with this for a while I was then able to create the merging effect I was looking for and replaced the .isDead() function.

Screen Shot 2016-02-24 at 12.24.28 AM

Lastly I applied separate x,y gravity forces to each color and got the emitter to move around with the mouse.

Screen Shot 2016-02-24 at 12.38.43 AM

This is where I sort of hit the wall and ran out of time. That being said, I really liked making a sketch that starts off kind of chaotic and random but will eventually stabilized to a predictable outcome each time. I’m really looking forward to being able to make these particles “smarter”.


Read More