วันจันทร์ที่ 25 สิงหาคม พ.ศ. 2557
Lab 2 - Task#1.5[Special] : Pen or Pencil [Pencils..s...s....s, a lot of PENCILS!!!] [Zoom out Ver.]
void setup()
{
size(100,1000);
background(255);
frameRate(60);
}
void draw()
{
float px,py;
float w,h,space;
background(255);
noStroke();
h=5;
px=-1;
py=h/2;
space=h;
for(int i=0;i<height/h;i=i+1)
{
w=(width/2)+width/6*sin(radians((frameCount+i*5)*2))-h/2;
draw_pencil(px,py+i*h,w,h);
}
}
void draw_pencil(float px,float py,float w,float h)
{
float a,b,c;
a=sqrt((3*(pow(h,2)))/4);
fill(250,180,0);
strokeWeight(3);
rect(px,py-(h/2),w,h/4);
rect(px,py+(h/4),w,h/4);
fill(255,200,0);
rect(px,py-(h/4),w,h/2);
fill(255,230,180);
triangle(px+w,py-h/2,px+w+a,py,px+w,py+h/2);
fill(0);
triangle(px+w+(a/2),py-(h/4),px+w+a,py,px+w+(a/2),py+(h/4));
}
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น