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

lab4balloon


void setup() {
  size(1000, 500);
  strokeWeight(5);
}
void draw() {
  background(255);
  int y= mouseY;
  int n=5;
  int count=0;
  while (count < n) {
    int x=count*120+200;
    balloon(x, y);

    count++;
  }

  if (y<=100) {
    fill(0,255,255);
  } else if (y>100 && y<300) {
    fill(255, 0, 0);
  } else if (y>=300) {
    fill(255, 255, 0);
  }
}
void balloon(int x, int y) {
  ellipse(x, y, 100, 100);
  line(x,y+50,x,y+150);
}

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

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