NOC Week 3 - Forces
This week, I made a sketch where users can make drawings that affect the movement of particles on screen, a combination of drawing and force simulation.
I began this week's assignment with the prompt of adding a wall repulsion force that pushes the object away from the walls. With help from Nuntinee, I achieved this by making a function in the object class that measures the distance between the position of the object and the center of the canvas, then use the x and y distance to apply as two different vectors for each axis as acceleration for the object. (and an "if" statement that determines weather the vector is positive or negative based on which side of the center the object is on)
Next I tried making multiple attractors so users can customize the interaction and see how the particles are affected, this was done by making the attractors an array and pushing a new object into the array when mouse is pressed.
Since the particles are already being repelled against the walls, I made it so the attractors repel the particles as well so the particles will get stuck in between the walls and the attractors(now repellers).
In the final step, I modified the alpha of the attractors and the color of the background and particles to make it into a consistent experience where yellow dots try to escape from pink areas (sides of the canvas and the attractors drawn by the user.