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

book_lab4


int moveY;
int cout;
void setup(){
size(1100,700);
}
void draw(){
 int count=0;
 int n=2;
 int pos=0;
 while(count<n){
   book(pos);
   pos=pos+550;
   count++;
//   fill(#000000);
//   rect(10,50,50,50);
 }
 //book();
 if(cout < 20){
  moveY++;
  cout++;
 }else if(cout > 0){
  moveY--;
  if(moveY == -20){
    cout=-20;
  }
 }
 println(moveY);
 print("..................");
 println(cout);
}
void book(int pos){
 int posy=50;
  //moveY=(moveY+1)%(100);
  fill(#D8BABA);
  rect(pos+0, 0, 549, 699);
  fill(#FFFFFF);
  rect(pos+0, 0, 55, 699);
  textSize(40);
      fill(#000000);
     text("1",pos+15,50);
      textSize(20);
      text("45B",pos+8,660);
  fill(#FF9966);
  rect(pos+60, 5, 485, 450);
//////////////////Body/////////////////
  fill(#000000);
  strokeWeight(4);

  ellipse(pos+300, posy+250-moveY, 240, 250);//face back
  fill(#FFFFFF);
  rect(pos+165, posy+251-moveY, 30, 40);//left ear
  rect(pos+405, posy+251-moveY, 30, 40);//right ear
  ellipse(pos+300, posy+254-moveY, 238, 245);
  fill(#FDFF40);//face front
     ellipse(pos+360, posy+245-moveY, 70, 80);//right eye
     ellipse(pos+240, posy+245-moveY, 70, 80);//left eye
  strokeWeight(2);
  fill(#000000);
   triangle(pos+300, posy+275-moveY, pos+285,posy+100-moveY, pos+315, posy+100-moveY);  //crest
  textSize(70);
      fill(#000000);
     text("The",pos+100,530);
      textSize(60);
     text("Ultraman",pos+250,530);
      textSize(40);
     text("Original",pos+380,580);
 /*
  println("My faverite book is ");
  println ("ultranma");
  println(-moveY);*/

}

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

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