Sunday, October 11, 2009

Homework 3: Interaction with mouse






(a)HW3-1








Java applet: http://icac.no-ip.org/ian/HW3-1/

This is the homwork extended HW02-3. Before this exercise, I didn't know that the picture made by processing can interact with mouse. This is really cool, especially in this exercise. Actually, it's hard to finish hw at beginning. After teacher gave some hints. This HW became more easy to complete. The most important part I learnt is this code: (mouseX-400)/15 In this code, It controls the moving range of circle. I felt that it's really clever to think of this way to solve problem. We actaully did some calculation to understand this line of code. Finally, we finished this homework. Still feeling this course is fun~








(b)HW3-2







Java applet: http://icac.no-ip.org/ian/HW3-2/

In HW3-2, because of HW3-1, I realized that the pic can interact with mouse. So it not seems hard in this HW. The important part I learnt form this hw is :

draw line: line(mouseX, mouseY,pmouseX, pmouseY);


change line color and build virtual button:

if(mousePressed == true && (mouseX>500 && mouseX<600)>300 && mouseY<400)){>
change line stroke weight: strokeWeight(10);






No comments:

Post a Comment