CLASS 002

sketch link
click the mouse, the background will change.
move the mouse, the line will start rotating.

 

The whole process of making this sketch took me a full day, yet I never lost interest or patience to keep going. (while it might just be a few minutes work for others) I sketched the four parts separately first, practicing each movements on a clean canvas, then combined them together.

key functions and logic used:
/var speed
/position = position + speed
/if (there's a limit for position ) speed = speed * -1

/for loop
/sin() / cos()

/mouseX*mouseY
/mousePressed

/if(){} + else{}

One of the biggest challenges is to make that line rotate from the middle, it's actually consisted of two lines, although it appears to be one single line. Just this simple logic took me almost an hour to figure out.

The second challenge, and still not quite solved problem is how to limit the rectangles in the bottom-right scene to not float out it's own section. (This is a reminder to self, I need to ask Mimi this question.)