color[] mycolor = {color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255))),
color(int(random(255)),int(random(255)),int(random(255)))
};
void setup()
{
background(122,122,122);
size(500,500);
}
void drawRect(float x,float y){
for (int i = 100; i > 0;i-=20){
color mycol = mycolor[i/10];
fill(mycol);
rect(x-i/2,y-i/2,i,i);
}
}
void draw()
{
drawRect(random(0, width),random(0, height));
}
void keyPressed(){
for (int i = 0; i <= 10;i++){
mycolor[i] =color(int(random(255)),int(random(255)),int(random(255)));
}
}
|