2010年10月28日 星期四

HW06: Image Animating Application

HW06-1:
1.
Images are colored with the tint() function. This function is used the same way as
fill() and stroke(), but it affects only images:

tint() //單一顏色遮罩住圖片,可以做出淡入淡出效果
noTint() //把tint關掉


2.讓圖片移動
就是讓 image(photo, x, y)裡的X和Y做增加或遞減


HW06-2: Coordinate system translation
translate(x, y) //平移系統座標
rotate(angle) //旋轉座標,逕度非角度,會順時鐘旋轉,且角度會一直累積,到2PI會回到原點
會動的電風扇




HW06-3: Easing Motion
創造一個球,跟著滑鼠跑,之後增加跟屁蟲XD

x1 += (mouseX- x1) * easing;  //easing是一個參數,設定跟緊的程度
y1 += (mouseY- y1) * easing;  







HW06-4: Storing mouse data in Arrays
把滑鼠座標存在陣列裡,之後複製前一個球等於下個球的位子

 for (int i = num-1; i > 0; i--)
 {
     x[i] = x[i-1];
     y[i] = y[i-1];
 }




補充: keyPressed //按鍵觸發布林事件


心得:
這次做得東西都和使用者互動有關係,不再是死死的程式,是生動活潑的!
我非常歡這樣的課程,希望能把這些所學應用到專題上。



沒有留言:

張貼留言