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

Lab04 : Flocks of Birds

int wing_original;
int dx=1;
void setup() {
  size(500, 500);
  strokeWeight(5);
}

void draw() {
  background(51);
  wing_original=mouseY;
  if (frameCount%30>=15) {
    wing_original+=30;
  } else
  {
    wing_original-=30;
  }
  dx=(dx+1)%200;
  stroke(255);
  cloud(dx, 50, 50);
  cloud(170+dx*0.8, 50, 70);
  cloud(350+dx*0.9, 80, 60);
  cloud(dx*1.2, 130, 40);
  cloud(230+dx*1.2, 150, 40);
  cloud(100+dx*1.2, 170, 40);
  draw_bird(mouseX, mouseY, 2, 2);
}

void draw_bird(int x, int y, int amount, int flocks) {
  int z=1, i=0, dx=0, dy=0, con=70;
  while (z=<flocks) {
    while (i<amount) {
      stroke(255);
      line(x+dx, y+dy, x-50+dx, wing_original+dy); //left
      line(x+dx, y+dy, x+50+dx, wing_original+dy); //right
      fill(0);
      ellipse(x+dx, y+dy, 30, 30);
      noStroke();
      fill(255, 255, 0);
      triangle(x-5+dx, y+dy, x+5+dx, y+dy, x+dx, y+9+dy);
      i++;
      dx+=120;
    }
    i=0;
    dx=z*70;
    z++;
    dy+=120;
  }
}

void cloud(float x, float y, int size) {  
  noStroke();
  fill(#02F0D2);
  ellipse(x, y, size, size);
  x+=size/2;
  ellipse(x, y, size, size); 
  ellipse(x, y-size/4, size, size);
  ellipse(x, y+size/4, size, size);
  x+=size/2;
  ellipse(x, y, size, size); 
  ellipse(x, y-size/4, size, size);
  ellipse(x, y+size/4, size, size);
  x+=size/2;
  ellipse(x, y, size, size);
}


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

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

commit เพิ่มเติม : เพื่ม userstory, bookmark

>>  add userstory ทำการเพิ่ม userstory ใน functional tests >>  add bookmark for user เพิ่มระบบ Bookmark โดยการสร้าง model ขึ...