วันอาทิตย์ที่ 30 สิงหาคม พ.ศ. 2558

[Pre-LAB3] Ballon

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

void draw()
{
  background(255);
  int posX = mouseX;
  int posY = mouseY;
  if(posY<40)
  {
    posY = 40;
    fill(#FF0000);
  }
  else if(posY>200)
  {
    posY = 200;
    fill(#FFF41F);
  }
  else if(posX<25)
  {
    posX = 25;
    fill(#1139F5);
  }
  else if(posX>275)
  {
    posX = 275;
    fill(#11F548);
  }
  else
  {
    fill(255);
  }
  draw_ballon(posX ,posY ,75);
}

void draw_ballon(int posX ,int posY ,int radius )
{
line(posX,posY,posX,100+posY);
ellipse(posX,posY,radius,radius);
}

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

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