Thursday, September 10, 2009
squaresnake
int r = 255;
void setup()
{
size(800,600);
}
void draw()
{
background(0,0,0);
for (int i=0; i < 30; i=i+1)
{
fill(r - i*width/2,125 + i*15,125-i*9);
translate(width/2,height/2);
rotate((i-15)*mouseX/width*PI/180);
translate(-width/2,-height/2);
rect(width/2 - i*5,height/2 - i*7,
mouseY/10 - i*1.2,mouseY/10 -i*2.3);
}
}
void setup()
{
size(800,600);
}
void draw()
{
background(0,0,0);
for (int i=0; i < 30; i=i+1)
{
fill(r - i*width/2,125 + i*15,125-i*9);
translate(width/2,height/2);
rotate((i-15)*mouseX/width*PI/180);
translate(-width/2,-height/2);
rect(width/2 - i*5,height/2 - i*7,
mouseY/10 - i*1.2,mouseY/10 -i*2.3);
}
}