กันยายน 06, 2558

Lab3_song

int limit=0;
int white=255;
int light_brown=#F7DEA7;
color screen;
color Line=255;
boolean dropNote=false;
int noteY=0;
void draw(){
  size(350,185);
  background(screen);
  limit++;
  limit %= 180;
  draw_song();
  if(dropNote){
    note();
    if(noteY>200){
      dropNote=false;
      noteY=0;
    }
  }
}
void draw_song(){
  int posX=100;
  posX+=limit;
  noStroke();
  //draw"THE"
  fill(Line);
  rect(posX-25,10,70,30); //blank"THE"
  fill(screen);
  rect(posX-25,15,7,25);
  rect(posX-13,15,7,25); //T
  rect(posX,10,15,12);
  rect(posX,27,15,13); //H
  rect(posX+20,10,3,30);
  rect(posX+28,15,17,7);
  rect(posX+28,27,17,8); //E
  triangle(posX+33,10,posX+45,45,posX+45,10);
  //draw"SCRIPT"
  fill(Line);
  arc(45,75,60,60,HALF_PI,TWO_PI);
  arc(45,131,70,70,HALF_PI+PI,TWO_PI+HALF_PI); //S
  arc(130,105,110,110,QUARTER_PI+PI/32,TWO_PI-QUARTER_PI-PI/32); //C
  rect(165,50,20,10);
  rect(165,105,20,10);
  arc(185,82.5,60,65,3*PI/2,5*PI/2);
  quad(170,115,185,115,215,147,215,163); //R
  rect(220,50,10,120); //I
  rect(235,50,10,120);
  rect(245,50,20,10);
  rect(245,105,20,10);
  arc(265,82.5,60,65,3*PI/2,5*PI/2); //P
  quad(265,50,330,50,335,60,265,60);
  rect(300,50,10,120); //T
  fill(screen);
  arc(45,76,40,40,HALF_PI,TWO_PI);
  arc(45,131,50,50,HALF_PI+PI,TWO_PI+HALF_PI); //S
  arc(130,105,90,90,QUARTER_PI,TWO_PI-QUARTER_PI); //C
  triangle(147,50,155,80,155,50);
  arc(185,82.5,40,45,3*PI/2,5*PI/2); //R
  quad(220,65,230,60,230,65,220,70); //I
  arc(265,82.5,40,45,3*PI/2,5*PI/2); //P
  triangle(220,170,310,130,310,170);
  fill(Line);
  rect(155,50,10,97); //R
}
void note(){
  fill(Line);
  ellipse(mouseX,noteY,15,15);
  stroke(Line);
  strokeWeight(3);
  line(mouseX+6,noteY,mouseX+6,noteY-35);
  line(mouseX+6,noteY-30,mouseX+13,noteY-10);
  line(mouseX+13,noteY-10,mouseX+12,noteY-5);
  noteY++;
}
void mouseClicked(){
  if(mouseButton==RIGHT){
    white*=-1;
    Line += white;
    screen += light_brown;
    light_brown*=-1;
  }
  else if(mouseButton==LEFT){
    dropNote=true;
  }
}
 

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

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