วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558

music_lab4


int moveX;
int moveY;
void setup(){

size(500,550);
}
void draw(){
 int count=0;
 int n=3;
 int pos=0;
 background(#F5F5F5);
 while(count<n){
 
   fill (#FFDEDE);
   textSize(60);
   text("Girl's",pos+50,80);
   text("Girl's",pos-50,160);
   text("Girl's",pos+50,240);
   text("Girl's",pos-50,320);
   text("Girl's",pos+50,400);
   text("Girl's",pos-50,480);
   text("Girl's",pos+50,560);
 
   pos+=220;
   count++;
 }
music(pos);
}

void music(int pos){
int posx=25;
int posy=7;
 moveX=(moveX+1)%4;
 moveY=(moveY+1)%4;
 //rect(0, 0, 499, 549);
  //left heart
stroke(#000000);
strokeWeight(10);
 line(246-posx+moveX, 85-posy, 190-posx+moveX, 15-posy); //1
 line(190-posx+moveX, 15-posy, 90-posx+moveX, 130-posy); //2
 line(90-posx+moveX, 130-posy, 246-posx+moveX, 321-posy); //3
 line(246-posx+moveX, 321-posy, 246-posx+moveX, 150-posy); //4
 line(246-posx+moveX, 150-posy, 155-posx+moveX, 150-posy); //5
stroke(#F23383);
strokeWeight(7.5);
 line(246, 85+moveY, 190, 15+moveY); //1
 line(190, 15+moveY, 90, 130+moveY); //2
 line(90, 130+moveY, 246, 321+moveY); //3
 line(246, 321+moveY, 246, 150+moveY); //4
 line(246, 150+moveY, 155, 150+moveY); //5
 //right heart
stroke(#000000);
strokeWeight(10);
 line(262+posx+moveX, 85-posy,318+posx+moveX, 15-posy); //1
 line(318+posx+moveX, 15-posy, 418+posx+moveX, 130-posy);  //2
 line(418+posx+moveX, 130-posy, 262+posx+moveX, 321-posy); //3
 line(262+posx+moveX, 321-posy, 262+posx+moveX, 150-posy); //4
 line(262+posx+moveX, 150-posy, 353+posx+moveX, 150-posy); //5
stroke(#F23383);
strokeWeight(7.5);
  line(262, 85+moveY,318, 15+moveY); //1
 line(318, 15+moveY, 418, 130+moveY);  //2
 line(418, 130+moveY, 262, 321+moveY); //3
 line(262, 321+moveY, 262, 150+moveY); //4
 line(262, 150+moveY, 353, 150+moveY); //5
//Heart WAVE
strokeWeight(1);
 line(150, 370+moveY, 185, 370+moveY);
 line(185, 370+moveY, 202, 344+moveY);
 line(202, 345+moveY, 202, 370+moveY);
 line(202, 370+moveY, 217, 344+moveY);
 line(217, 345+moveY, 217, 385+moveY);
 line(217, 385+moveY, 234, 357+moveY);
 line(234, 357+moveY, 244, 357+moveY);
 line(244, 357+moveY, 244, 370+moveY);
 line(244, 370+moveY, 259, 370+moveY);

 line(259, 370+moveY, 276, 344+moveY);
 line(276, 344+moveY, 276, 370+moveY);
 line(276, 370+moveY, 292, 344+moveY);
 line(292, 344+moveY, 292, 384+moveY);
 line(292, 384+moveY, 309, 357+moveY);
 line(309, 357+moveY, 319, 357+moveY);
 line(319, 357+moveY, 319, 370+moveY);
 line(319, 370+moveY, 354, 370+moveY);
 fill(#F23383);
 ellipse(354, 370+moveY, 3, 3);
 if(mousePressed == true){
    textSize(90);
    fill(#000000);
    text("G",130+moveX,478+moveY);
 }
 else{
    textSize(90);
    fill(#F23383);
    text("G",130+moveX,478+moveY);
 }
 if (keyPressed == false){
    fill(#FFA5CB);
    textSize(40);
    text("irls",191,445);
    textSize(40);
    text("eneration",189,478);
 }
 else{
   fill(#ED0707);
    textSize(40);
    text("irls",191,445);
    textSize(40);
    text("eneration",189,478);
 }
    fill(#FFFFFF);
  println("My faverite Music is ");
  println ("Girlsgeneration");
  println(moveX);

}

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

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