Im sure many of you are familiar with Pixar, and their signature lamp. This was my inspiration for the conditionals project. I had a lot of fun drawing up a design as simple as possible while still keeping everything recognizable (I hope).
The goals was to use a conditional statement that creates multiple outcomes. So, I decided to mimic a portion of the Pixar short of the lamp following the ball.
On mouseClicked() there is a boolean variable (ballBounce) that lets the if statement know when the mouse has been clicked. When satisfied the ball will bounce and the lamp with translate and rotate the lamp shade and bulb to move at the same speed and direction as the ball.
I had a particularly hard time with rotating the 'lamp shade' and bulb around the top left point of the lamp shape. I tried creating shapes, which I left in the code so you may see where my mind was headed. Unfortunately that did not work. I knew to translate the shapes I wanted to move but it was just not working for a long time. Until I found out the point I want to rotate around needs to be (0,0). The entire time I had the coordinate at (350,150) and it kept flying to the side and spinning out of control. It was a nightmare.
CODE
SKETCH
DEMONSTRATION