我用滑鼠的程式 圓圈圈把它畫一個類似骷髏頭的樣子
void setup(){
size(600,600);
background(0,0,0);
}
void draw(){
background(0,0,0);
fill(255,255,255);
ellipse(mouseX,mouseY,50,50);
fill(255,255,255);
ellipse(125+50,100+50, 100,60);
ellipse(125+50,100+50, 100,45);
fill(255,1,1);
ellipse(125+50,100+50, 50,50);
ellipse(125+50,100+50, 23,23);
fill(1,1,1);
ellipse(125+50,100+50, 8,8);
ellipse(125+50,100+38, 10,10);
ellipse(125+40,100+58, 10,10);
ellipse(125+60,100+58, 10,10);
fill(255,255,255);
ellipse(125+300,100+50, 100,60);
ellipse(125+300,100+50, 100,45);
fill(255,1,1);
ellipse(125+300,100+50, 50,50);
ellipse(125+300,100+50, 23,23);
fill(1,1,1);
ellipse(125+300,100+50, 8,8);
ellipse(125+300,100+38, 10,10);
ellipse(125+290,100+58, 10,10);
ellipse(125+310,100+58, 10,10);
}
(2)圖追滑鼠指標圖(一圖追一圖)
我用血輪眼追血輪眼的程式碼
void setup() {
size(600, 600);
frameRate(15);
}
void eyered(int a, int b, int c, int d) {
translate(-450,-150);
fill(255, 255, 255);
ellipse(125+300, 100+50, 100, 60);
ellipse(125+300, 100+50, 100, 45);
fill(255, 1, 1);
ellipse(125+300, 100+50, 50, 50);
ellipse(125+300, 100+50, 23, 23);
fill(1, 1, 1);
ellipse(125+300, 100+50, 8, 8);
ellipse(125+300, 100+38, 10, 10);
ellipse(125+290, 100+58, 10, 10);
ellipse(125+310, 100+58, 10, 10);
}
void eyeredl(int a, int b, int c, int d) {
//translate(-300,-150);
fill(255, 255, 255);
ellipse(125+300, 100+50, 100, 60);
ellipse(125+300, 100+50, 100, 45);
fill(255, 1, 1);
ellipse(125+300, 100+50, 50, 50);
ellipse(125+300, 100+50, 23, 23);
fill(1, 1, 1);
ellipse(125+300, 100+50, 8, 8);
ellipse(125+300, 100+38, 10, 10);
ellipse(125+290, 100+58, 10, 10);
ellipse(125+310, 100+58, 10, 10);
}
int x=100, y=100;
void draw() {
fill(255, 255, 0);
background(0, 0, 0);
fill(255, 255, 255);
pushMatrix();
translate(x,y);
eyered(mouseX, mouseY, 50, 50);
popMatrix();
pushMatrix();
translate(mouseX,mouseY);
eyered(mouseX, mouseY, 50, 50);
popMatrix();
x=(x+mouseX)/2;
y=(y+mouseY)/2;
}
4.本周心得
今天學到了控制圖片位置的程式碼
對於學到的新事物還是很興奮
一開始用白色圓圈做出延遲效果
就隨手畫了一個骷髏頭+之前的血輪眼
然後第二項的圖追圖,也學到了怎麼樣在程式中
整麼樣包一整個圖片程式去令他做動作
另外老師展示了讓眼球動我還想用我的血輪眼來試試看
100
回覆刪除