After browsing through the sample programs on Processing.org we started thinking of ideas that pulled multiple of the programs together. We both liked the bouncing ball and wanted to try and manipulate it’s shape while it moved. After discovering the GUI button to change the colors, we wanted to add the functionality of having multiple colors and have them change when we moused over their shape. We then found the multiple bouncing balls which was better suited for having many colors. After choosing random colors, we came up with the idea to have red yellow and blue and it made us think of a stop light.
From there we created the scene with the background image of the four way street with the stoplight, and positioned the three buttons as if they were hanging above the street. We then needed to manipulate the motion of the bouncing balls to coordinate with the direction of the light. So we tampered with the display() function, adding in additional motion variables of gravity, friction and spring. This determine, how much the bouncing balls, fall to the bottom of the parameter, and how they interact with one another. We adjusted these variables so that when you mouseover the red “light” the balls fall to the bottom and almost come to a complete stop; on the yellow they move slowly through the entire space, and on blue…instead of green we say “GO BLUE!” and the balls move quickly having little gravity and increased spring, when they collide off each other.
Red-Stop Yellow-Slow Blue-Fast
gravity = 0.90; gravity = 0.00; gravity = 0.07;
spring = 0.00; spring = 0.00; spring = 2.90;
friction = 0.00; friction = -0.07; friction = 0.80;
These are the three sample codes we combined and manipulated to make our Stop Light Program.