ICM Class 3 – Notes from Tutorials

Here are a few sketches made after following the online tutorials. There are lots of notes in the sketches on alpha.editor.p5js.org to explain my code so that I fully understand what’s going on.

Tutorial 3.2: Draw a ball that bounces up and down on both x and y, and changes color.

Question: How do I get the ball to move around more randomly? I tried using the random() but the ball went on the fritz : /

Tutorial 3.3: Use “if/else if” statements to draw shapes with colors as you move your cursor left to right

Tutorial 3.4 Roll over a button to make it appear, and press the mouse within the button to change the background.

Tutorial 4.1 Use while and for loops to draw squares and circles across the screen, while incrementally changing the color of the circles, too.

Question: What’s the best way to have changed the blue color incrementally? I found three ways to do it, found in my code.

Tutorial 4.2 Use nested for loops to draw circles that change color and repeat across the canvas as the mouse moves. Also, the background changes color when you press the mouse.

Question: The mousePressed didn’t work when I placed it after the circle for loops, but does when I place it beforehand. Why is this? Are the circles overriding this code?