2008年4月3日 星期四

幾何圖

小畫家



processing



表現太陽與月亮
不過主要是練習方型圓型還有三角片
程式:
void setup()
{
size(800 , 600);
background(255,255,255);
noLoop();
}
void draw()
{
haha();
chih_1();
chih_2();
}

void haha()
{ //背景的地方
fill(1,0,128);
ellipse(800,600,1400,1200);
fill(1,0,128);
ellipse(800,600,1600,1200);
}

void chih_1(){ //圓形的部份
fill(0,0,0);
ellipse(400,370,640,330);
fill(0,0,254);
ellipse(355,345,540,230);
fill(255,255,1);
ellipse(300,320,400,130);
fill(0,255,255);
ellipse(225,305,230,60);

fill(255,0,0);
ellipse(0,0,260,260);
}
void chih_2(){
fill(255,0,0);
rect(23,140,20,200);
fill(255,0,0);
rect(140,23,200,20);
fill(255,0,0);
triangle(150,100,100,150,180,180);
}

沒有留言: