Link: https://editor.p5js.org/Skye/sketches/1nqThwswn
Description:
For this assignment, I created a fluid simulation effect by using the concept of autonomous agents. I created a class of vehicles to represent fluid particles and placed them at the button of the canvas. The I let each vehicle to seek the position of mouse and add the repulsion force to them once the mouse gets into the detecting area. The detect area I assigned between mouse and particles were originally the exact radius of the particles, however, in that case only a few particles around the mouse would move. Therefore I scaled up the detecting area to 20 times of radius so that it looked like the whole particle systems moving. I met some problem then as once the particles got the force they will just move away and never come back. Candy taught me how to pull the particles back by mapping the force accoding to particles’ current position and their previous position. I then, stepped to change the color of the particles according to their position to create the water effect.
The outcome is that when moving the mouse around, the particles will move and create an effect of waves.