void setup(){ size(600,600); } void draw(){ PImage YA; YA=loadImage("C:/Documents and Settings/s513s/桌面/aaa.jpg"); image(YA,mouseX,mouseY); PImage HA; HA=loadImage("C:/Documents and Settings/s513s/桌面/bbb.jpg"); image(HA,mouseX+150,mouseY+150); }
2.讓圖片追著圖片
void setup(){ size(1000,800); } float x=100,y=100; void draw(){ fill(255,255,255); rect(0,0,1000,800); PImage HA; HA=loadImage("C:/Documents and Settings/s513s/桌面/複製 -abc.png"); image(HA,mouseX,mouseY); PImage YA; YA=loadImage("C:/Documents and Settings/s513s/桌面/複製 -qwe.png"); image(YA,x,y); x=x*0.99+mouseX*0.01; y=y*0.99+mouseY*0.01; }
小鴨追母鴨
void setup(){
size(1000,800);
frameRate(12);
}
float [] x = new float[10];
float [] y = new float[10];
void draw(){
fill(23,95,166,180);
rect(0,0,1000,800);
PImage HA;
PImage YA;
HA=loadImage("C:/Documents and Settings/s513s/桌面/d.png");
image(HA,mouseX,mouseY);
x[9]= mouseX;
y[9]= mouseY;
for(int a=0;a<9;a++){
YA=loadImage("C:/Documents and Settings/s513s/桌面/f.png");
image(YA,x[a]+150,y[a]+100);
x[a]=x[a+1];
y[a]=y[a+1];
}
}
心得:這次的作業終於有一點接觸到互動的感覺了,滿有成就感。
95
回覆刪除