Nature of Code: Week 9 assignment–Moon(Candy)

Documented by: Candy Bi

Project name: Spring

Professor: Moon

Date: 4/16/2019

Link: https://editor.p5js.org/candy/present/Fa4vDtNzZ

Video: spring

The project of Spring is developed based on the demo we did in class. Instead of having two balls as objects. I created a class called balls and pushes them over the whole canvas. Each is connected to the two balls connected to it which I called “spring”. These lines would create force onto the balls they are connecting.

Then I add the function to check collision so that balls would feel more natural as with a mass. Collision checking and spring force then add to the interesting dynamic of those balls together.

For the interaction part, I keep the drag function and made the ball being dragged white so that it would be more clear to audience. Additionally, I add the function of key-pressed for sometimes drag is hard to control: balls would just fly away when mouse moves too fast out of the ball. The key-pressed function is only functioned on the first ball in the class to allow for free movements create by those springs.

Leave a Reply