วันเสาร์ที่ 12 กันยายน พ.ศ. 2558

Lab4-Many balloon

void setup() {
  size(500, 500);
}
void draw() {
  size(500,500);
  background(#FFFFFF);
  int x=mouseX;
  int y=mouseY;
  balloon(x, y);
}
void balloon(int x, int y) {
  int count = 4;
  int n = 0;
  int another = 0;
  if (x <250 && y < 250) {
      background(#CCFF00);
    fill(#FF6600);
  }else if(x > 250 && y < 250){
  background(#FF0000);
    fill(#990066);
  }else if(x < 250 && y > 250){
    background(#990066);
    fill(#CCFF00);
  }else if(x > 250 && y > 250 ){
  background(#FF6600);
    fill(#FF0000);
  }
  while(n<=count){
  line(x+another, y+another, x+another, y+200+another);
  ellipse(x+another, y+another, 100, 100);
  another+=50;
  n+=1;
  }
}

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

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