กันยายน 13, 2558

Lab4_balloons

void draw(){
  int count=-1;
  size(200,400);
  background(255);
  while(count<2){
    int posX=width/2;
    posX+=(55*count);
    draw_balloon(posX);
    count++;
  }
}
void draw_balloon(int x){
  int posY=mouseY;
  color ball;
  if(mouseY<=50){
    posY=50;
    ball=#00FF00;
  }
  else if(mouseY>=300){
    posY=300;
    ball=#FF0000;
  }
  else ball=255;
  strokeWeight(1.5);
  fill(ball);
  line(x,posY,x,posY+100);
  ellipse(x,posY,50,50);
}
 

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

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