Sunday, September 13, 2015

Lab4 - Balloon

void setup(){
 size(300, 300);
}

void draw(){
  background(#000000);
  int count=0;
  int posX = mouseX;
  int posY = mouseY;
   if(posY<100){
   fill(#DD0000); //change color red
  }
  else if(posY>200){
   fill(#00DD00); //change color green
  }
  else fill(#000000); //change color clear
  while(posX+(count*55)< width){
   draw_ballon(posX+(count*55) ,posY);
   count = count+1;
  }
}

void draw_ballon(int posX, int posY){
 ellipse(posX ,posY, 50, 50);
 stroke(#FFFFFF);
 line(posX ,posY+25, posX, posY+75);
}

No comments:

Post a Comment