NOC W3 – Party Popper (Phenomenon with Forces)

p5.js Web Editor | NOC W3-A Phenomenon with Forces (p5js.org)

For this assignment, I created a party popper that could burst out some confetti when the user clicks the mouse.

To create a more natural sense of confetti popping out of the popper, I applied force including gravity and air resistance. The gravity is based on the mass assigned to each of the confetti, which is a random value between 0.05 and 0.1, and then multiplied by the constant gravity value. As for the air resistance, it is based on the formula F=(1/2)CρSV^2, with (1/2)Cρ set as a constant value C_AirResistance, S being the size of the confetti, and V is the speed of the confetti. 

The velocity of each confetti is also assigned with a random x value so that different confetti could spread out and create the expected effect.

For further development, I wanted to create an animation for the popper with which the popper will have the motion of popping things out when clicking the mouse. However, I wasn’t able to find out how to create an animation that could be triggered by mouse pressed. 

 

Leave a Reply

Your email address will not be published. Required fields are marked *