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

Lab 2 : Song (use function + move)

int posX=50;
int posW=500;
int posY=0;

void setup(){
size(500,500);
frameRate(2);
}

void draw(){
  draw_song(50,10);
    posX = (posX+20)%width;
    posW = (-posW+250)%width;
    posY = (posY+50)%height;

}

void draw_song(int x,int y){
background(#FCECB5);

fill(0);                               //in door
stroke(0);
rect(150+x,300+posY+y,200,250);

fill(#D36A06);                        //l door
stroke(#D36A06);
rect(135+x,300+posY+y,15,250);

fill(#D36A06);                        //r door
stroke(#D36A06);
rect(350+x,300+posY+y,15,250);

fill(#D36A06);                       //on door
stroke(#D36A06);
rect(135+x,285+posY+y,230,15);

fill(#FF0B03);                       //open
stroke(#FF0B03);
ellipse(180+x,450+posY+y,20,20);

/////word on door WELCOME////

fill(#E9FF03);
textSize(20);
text("W",180+x,360+posY+y);

fill(#03F9FF);
textSize(20);
text("E",200+x,360+posY+y);

fill(#05FF03);
textSize(20);
text("L",220+x,360+posY+y);

fill(#FF9F03);
textSize(20);
text("C",240+x,360+posY+y);

fill(#AC6BF7);
textSize(20);
text("O",260+x,360+posY+y);

fill(#6BF7CA);
textSize(20);
text("M",280+x,360+posY+y);

fill(#FF0000);
textSize(20);
text("E",300+x,360+posY+y);

/////name of song/////

fill(#0D08A5);
textSize(80);
text("Pra",posX+x,140+y);

fill(#08A50E);
textSize(80);
text("Tu",150+posX+x,140+y);

fill(#BC0606);
textSize(80);
text("Jai",300+posX+x,140+y);

/////name of singer/////

fill(#AC39F5);
textSize(40);
text("Sao Sao Sao",posW+x,210+y);

}

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

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