วันจันทร์ที่ 15 กันยายน พ.ศ. 2557
Lab 3 : Task#1 - Balloon
Warning >>> Bug on firefox
int num=100,stop_r_p=0,count=0,click_fix=0;
float[] px=new float[num],py=new float[num];
float a;
void setup()
{
size(500,500);
strokeWeight(3);
for(int i=0;i<num;i++)
{py[i]=height+100;}
}
void draw()
{
background(150);
if(stop_r_p<=num)
{
for(int i=0;i<num;i++)
{px[i]=random(0,width);stop_r_p++;}
}
if(mousePressed&&click_fix==0)
{
click_fix=1;
count=count+1;
if(count==num)
{count=0;}
py[count]=height+100;;
}
for(int i=0;i<count;i++)
{
draw_balloon(px[i],py[i]);
a=0.005*(py[i]+height);
py[i]=py[i]-a;
}
}
void draw_balloon(float px,float py)
{
fill(255,190,210,200);
ellipse(px,py,100,120);
line(px,py+60,px,py+180);
fill(255,190,210);
triangle(px,py+63,px+7,py+75,px-7,py+75);
}
void mouseReleased()
{
click_fix=0;
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น