Recitation 06: Processing Animation by Yifei Li

For this recitation, I made something different from the last one. I created a square, which can move around the canvas based on the keyboard’s arrow key input. And once it reaches the edges, the background will turn red, and it can’t pass.

Homework

Step 1: This one was easy. I only needed to create a circle at the center of the canvas.

Step 2: I was stuck here for a while because I could only make it contract for once and it continued to expand. After searching I realized I can use a variable to represent different situations, like when to contract, when to expand.

Step 3: This one took me a while as well. I first tried random, but it didn’t work well. The color changed so suddenly. So later I used the same method in step2  to change the HSB value to make the color change smoothly. From this, I learned something about colorMode(HSB), which is hue(0-360), saturation(0-100), and brightness(0-100). It changes the color quite differently from RGB.

Step4: This step was relatively easy as I had used the keyboard code in the recitation, so I just copied it and made a few small changes.

From the homework and the recitation, I think some interesting functions I used are if&else statement (they are super helpful!), HSB colorMode, keyCode. I’m also more familiar with Processing basics.

Leave a Reply