2008年5月6日 星期二

花-自點


程式碼:
void setup(){
size(800,600);
background(0);
}
void draw(){
for(int i=0;i<50;i++)
{
float x,y;
float a1,a2,a3,a4;
a1=random(0,255);
a2=random(0,255);
a3=random(0,255);
a4=random(0,255);
x=random(0,800);
y=random(0,600);
if (mousePressed == true)
{
smooth();
stroke(a1,a2,a3,a4);
translate(mouseX, mouseY);
// translate(x,y); // Set initial offset 座標
for (int j = 0; j <50; j++)
{
strokeWeight(j); // Increase stroke weight
rotate(PI/6); // Accumulate the rotation
line(0, 0, 55, 17);
}
}
}
}

沒有留言: