วันอาทิตย์ที่ 30 สิงหาคม พ.ศ. 2558

Lab2-Deadmau5 Function

int x = 280;
int y = 250;
int speed=5;

 
   void setup(){
       size(500,500);
       background(0);
       float sizeX = 190;
       float sizeY = 190;
   }
 
   void draw(){
        x=x+speed
        size(500,500);
        background(0);
        ear(370,150);
        ear(130,150);
        face(250,250);
        eye(280,250);
        eye(370,250);
        mouth(280,250);
        //word
        textSize(50);
        fill(#FFFFFF);
        text("Deadmau5",x-260,y+150);
        text("Professional Griefers",x-260,y+200);
        if(x>400){
            speed=-5
        }else if(x<50){
            speed=5
        }
       
   }
 void ear(int posX, int posY){
        fill(#CC0000);
        ellipse(posX,posY,220,220);
 }
 void face(int posX, int posY){
     ellipse(posX,posY,190,190);
 }
 void eye(int posX, int posY){
     fill(#FFFFFF);
     strokeWeight(1);
     ellipse(posX-80,posY-20,50,50);
     strokeWeight(5);
     line(posX-90,posY-30,posX-70,posY-10);
     line(posX-70,posY-30,posX-90,posY-10);
 }
void mouth(int posX, int posY){
    strokeWeight(1);
    fill(0);
    arc(posX-30,posY+10,150,150,0,PI);
    fill(#FFFFFF);
    triangle(posX-90,posY+10,posX-80,posY+60,posX-70,posY+10);
    triangle(posX-65,posY+10,posX-50,posY+80,posX-35,posY+10);
    triangle(posX-25,posY+10,posX-10,posY+80,posX+5,posY+10);
    triangle(posX+10,posY+10,posX+20,posY+60,posX+30,posY+10);
}
 

ไม่มีความคิดเห็น:

แสดงความคิดเห็น