วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558
Lab 3 : Flying Bird
float wing=0;
void setup(){
size(500,500);
frameRate(100);
}
void draw(){
int X=mouseX;
int Y=mouseY;
int cloudX;
int cloudY;
background(#77D8E8);
cloud(50,20);
cloud(450,200);
cloud(200,400);
wing=mouseY;
if(frameCount%60>30){
wing+=40;
}else{
wing-=60;
}
if(mouseY<=250){
wing+=40;
}else{
wing-=30;
}
draw_bird(X,Y);
}
void draw_bird(int X,int Y){
stroke(0);
fill(#FFB40F);
quad(X-50,Y, X-100,Y-10, X-150,wing, X-100,Y+10);
quad(X+50,Y, X+100,Y-10, X+150,wing, X+100,Y+10);
fill(#FF0F64);
ellipse(X,Y,130,150); //body
fill(#FFFFFF);
ellipse(X-30,Y-20,50,50); //eye outside
ellipse(X+30,Y-20,50,50);
fill(0);
ellipse(X-30,Y-10,20,20); //eye inside
ellipse(X+30,Y-10,20,20);
fill(#ffffff);
ellipse(X-35,Y-10,5,5); //eye
ellipse(X+25,Y-10,5,5);
fill(#FCF624);
quad(X,Y+5,X+10,Y+20,X,Y+35,X-10,Y+20); //lip
}
void cloud(int cloudX,int cloudY){
noStroke();
fill(#ffffff);
ellipse(cloudX,cloudY,80,80);
ellipse(cloudX-50,cloudY+30,80,70);
ellipse(cloudX+60,cloudY+30,100,80);
ellipse(cloudX+10,cloudY+50,100,100);
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น