วันเสาร์ที่ 12 กันยายน พ.ศ. 2558

Lab 4 : favorite movie (loop)


int swW=0;
int swH=0;
void setup() {
  size(450, 300);
}
void draw() {
  int n=0;
  int m=0;
  background(#ffd800);
  text_BILL();
  while(n<5) {
  draw_sword(mouseX+m,mouseY);
  n++;
  m-=100;
  }
  text_KILL();

}
void draw_sword(int x,int y) {
  //sword
  noStroke();
  fill(0);
  //black0-1
  rect(350+x, 0+y, 50+swW, 140+swH);
  //black0-2
  rect(348+x, 140+y+swH, 54+swW, 30+swH);
  //black0-3
  rect(330+x, 170+y+swH, 90+swW, 8+swH);
  //black0-4
  rect(348+x, 178+y+swH, 54+swW, 3+swH);
  //white0-5
  fill(255);
  rect(350+x, 181+y+swH+swH, 50+swW, 10+swH);
  //black0-6
  fill(0);
  rect(348+x, 191+y+swH, 54+swW, 3+swH);
  //black0-7
  rect(350+x, 194+y+swH, 50+swW, 106+swH);
  //shadow
  //white1-1
  fill(255);
  rect(350+x, 0+y, 30+swW, 140+swH);
  //white1-2
  triangle(360+x, 194+swH+y, 390+swW+x, 194+swH+y, 375+x+(swW/2), 204+swH+y);
  //white1-3
  quad(360+x, 219+swH+y, 375+(swW/2)+x, 209+swH+y, 390+swW+x, 219+swH+y, 375+x, 229+swH+y);
  //white1-4
  quad(360+x, 244+swH+y, 375+(swW/2)+x, 234+swH+y, 390+swW+x, 244+swH+y, 375+x, 254+swH+y);
  //white1-5
  quad(360+x, 269+swH+y, 375+(swW/2)+x, 259+swH+y, 390+swW+x, 269+swH+y, 375+x, 279+swH+y);
  //white1-6
  quad(360+x, 294+swH+y, 375+(swW/2)+x, 284+swH+y, 390+swW+x, 294+swH+y, 375+x, 304+swH+y);
}
void text_KILL() {
  textSize(150);
  //text-KILL
  fill(#ca0101);
  text("KILL", 10, 140);
}
void text_BILL() {
  textSize(150);
  fill(0);
  text("BILL", 10, 270);
  //cut
  stroke(#ffd800);
  strokeWeight(3);
  line(0, 260, 330, 180);
}
void draw_cut() {
  fill(255);
  strokeWeight(10);
  line(random(0,width),0, random(0,width),300);
}
void keyPressed(){
  frameRate(10);
  fill(0,0,0,10);
  rect(0,0,width,height);
  fill(#ca0101);
  ellipse(random(0,width), random(0,height), 150, 150);
}

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

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