Week 2 - Conditional Statements

This week was about deeper level or conditional statements that can be made with p5.js to create an interactive animation. The conditional codes allows more freedom with controlling the variables and using them in lines of codes, however, while I actually tried to manipulate the (mouseX, mouseY) code in worksheets, it happened like this:

The mouse was indeed moving with the rectangle, but the rectangle itself was continuously changing by different height and weight, and the only the top right corner was actually following the mouse.

And then I figured that the arguments made in the line, I did not state clearly with the relationships of the height and the weight of the rectangle. It should be like the rect (x, y, 2x,2y), and when I define x = mouseX, y = mouseY, it secured the current position of the points in relation to the mouse controlling direction.

For the recreation of the self-portrait:

I used random function to create the color of the flower pedal, and it is changing every second as long as the file opened.

And I also used the mouseX, mouseY to recreate the eyeball for moving opposite direction each time when the mouse was waving to another direction.
the first figure above is the mouse moving to the right while the second figure above is when the mouse moving to the left side.

And here is my final Ver2. Self-Portrait: My Self-Portrait Ver.2