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

lab 4 flock of birds

int space = 5;
void setup() {
  size(900, 500);
  strokeWeight(6);
}
void draw() {
  background(34, 88, 126);
  int posX = mouseX;
  int posY = mouseY;
  if (frameCount%30>15) {
    space = 120;
  } else {
    space = -55;
  }
  draw_birds( posX, posY);
}
void draw_birds(int posX, int posY) {
  int radius = 60;
  int string_length = 50;
  int birds = 0;
  int new_birds = 0;
  int new_birds2=0;
  int number = 6;
  while (birds<number) {
    fill(255, 0, 0);
    stroke(0, 0, 0);
    ellipse(posX+new_birds, posY+new_birds2, radius, radius);
    fill(255, 255, 255);
    stroke(0, 0, 0);
    line(posX+30+new_birds, posY+new_birds2, posX+70+new_birds, posY+new_birds2+string_length-space);
    line(posX-30+new_birds, posY+new_birds2, posX-70+new_birds, posY+new_birds2+string_length-space);
    noStroke();
    ellipse(posX+new_birds-13, posY+new_birds2-10, radius-45, radius-45);
    ellipse(posX+new_birds+13, posY+new_birds2-10, radius-45, radius-45);
    fill(0, 0, 0);
    ellipse(posX+new_birds-13, posY+new_birds2-7, radius-55, radius-55);
    ellipse(posX+new_birds+13, posY+new_birds2-7, radius-55, radius-55);
    fill(253, 249, 64);
    triangle(posX+new_birds-30, posY+new_birds2+40, posX+new_birds-10, posY+new_birds2+5, posX+new_birds+10, posY+new_birds2+5);
    new_birds = new_birds +150;
    new_birds2 = new_birds2+50;
    birds = birds +1;
  }
}

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

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