Link to sketch: LINK
For this assignment, I was working with my friend Khalinda who came up with the idea of a tv screen and remote that we can use to turn on and off an animation using a button. Khalinda prepared the drawing using a generous amount of translate(), push(), and pop() to allow for easy rotation without letting it affect all the other shapes being drawn.
Next, I changed up the colors and started working on the button interactivity. I created some global variables that I anticipated I would need.
We had a separate playAnimation() function to organize our code a bit. playAnimation() would only be called if the tv was on. It would draw an X shape of spinning squares centered in the middle of the tv screen. We used push() and pop() before and after it was being drawn because the squares were consistently being located.
Then I added another interactive yellow button that only works if the tv is already on. While the animation is playing, if the yellow button is pressed, it would slow down the spin (by reducing the rotateConstant).
Lastly, I added a repeating grid of squares to snazz up the design. The nested for loops helped me draw a square every 40 pixels. I realized I forgot to set the stroke and fill after I ran this code, but then realized I actually liked it better that way. It was cool to see the size and color change slightly as the buttons were being pressed and animations were being played as well.