http://icac.no-ip.org/silvia//Silvia_96160552_HW03_1/applet/
In this exercise, I am more familiar with the for-loop function. However, I got stuck in the problem which we have to make the circles moved while moving the cursor at the same time. I have no idea about doing this in the beginning. Fortunately, I can use mouseX and mouseY to deal with this task. All I need to know is to calculate the center of the display window which is (400, 300). While the mouse start moving, mouseX and mouseY values are 0, then I can use println(mouseX+" "+mouseY) to see where the exact position of moving cursor. Finally, I can define specific values to divide mouseX coordinate and mouseY coordinate respectively to make the eyes move around with cursor. I think "mouseX and mouseY " is fantastic because it makes picture move and it looks like more vivid than it used to be.
HW03-2:
http://icac.no-ip.org/silvia//Silvia_96160552_HW03_2/applet/
Respecting this case, I think everything is ok for me. The only
thing I need to memorize is the difference between setup() and
draw() functions. The commands in setup() will only execute
once not like draw() can be redid and renewed again. That's
what I learned from my mistakes. After that, I use one more code
"mousePressed == true" in "if" statement which means after
mouse clicked on the display window the following code will be
executed. Once I can draw a line,then I have to find out the X
coordinate and Y coordinate of each rectangle. So that, I can
define the values to limit the movement of mouseX and mouseY
in the rectangles. Afterward, I am able to change the weight of
strokes and even colors by using strokeWeight() and stroke()
functions. That's the way of what I have done last week. It was a
really fabulous experience that I am able to use processing
program to generate a drawing board which is closely similar to
the basic application of paint tool.
No comments:
Post a Comment