love

วันอังคารที่ 15 กันยายน พ.ศ. 2558

Lab4 - Books

//K.Thanapat
int y;
void setup(){
  size(500 ,500);
  frameRate(100);
}
void draw(){
  background(0);
  int x = 0;
  int wid = 50;
  int high = 70;
  int count = 0;
  int num =9;
  y=(y+5)%height;
  draw_book(x, wid ,high);
  draw_books(x ,count ,num ,wid ,high);
}
void draw_book(int x , int wid ,int high){
  //cover
  stroke(0);
  fill(255 ,219 ,183);
  rect(x ,50+y ,wid ,high);
  //blue
  noStroke();
  fill(128,255,255);
  rect(x+4 ,60+y ,wid-2 ,high/3);
  //yellow
  fill(249,253,74);
  rect(x+10 ,50+y ,wid/3-2 ,high);
  //name
  fill(255);
  stroke(40,255,95);
  strokeWeight(2);
  rect(x+5 ,107+y ,wid/1.5-2 ,high/6);
}
void draw_books(int x,int count,int num ,int wid , int high){
  while(count<=num){
    stroke(0);
    fill(255 ,219 ,183);
    rect(x+wid*count ,50+y ,wid ,high);
    //blue
    noStroke();
    fill(128,255,255);
    rect(x+wid*count+4 ,60+y ,wid-4 ,high/3);
    //yellow
    fill(249,253,74);
    rect(x+10+wid*count ,50+y ,wid/3-2 ,high);
    //name
    fill(255);
    stroke(40,255,95);
    strokeWeight(2);
    rect(x+5+wid*count ,107+y ,wid/1.5-2 ,high/6);
    count++;
  }
}

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

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