xxxxxxxxxx
int numLines= 200;
float [] lx1 = new float [numLines];
float [] ly1 = new float [numLines];
float [] lx2 = new float [numLines];
float [] ly2 = new float [numLines];
int numRect = 20;
float [] rx = new float [numRect];
float [] ry = new float [numRect];
float [] rSize = new float [numRect];
color [] rectClr = new color [numRect];
boolean clicked = false;
int lastTimeChanged = 0;
int timeBetweenChanges = 1500;
void setup() {
size (500, 700);
smooth();
for (int i = 0; i < numLines; i++ ) {
lx1[i] = random(0, width/3);
ly1[i] = random (height);
lx1[i] = random(width);
ly1[i] = random (height);
}
for (int i = 0; i < numRect; i++) {
rx[i] = random (width);
ry[i] = random (height);
rSize[i] = random (150);
rectClr[i] = color (random(255), random(255), random(255) );
}
}
void draw() {
background (0);
strokeWeight(2);
stroke(0);
for (int i = 0; i < numRect; i++) {
fill (rectClr[i]);
rect (rx[i], ry[i], rSize[i], rSize[i]);
}
strokeWeight(1);
stroke(255);
for (int i = 0; i < numLines; i++) {
line (lx1[i], ly1[i], mouseX, mouseY);
}
checkReset();
}
void checkReset () {
if (lastTimeChanged + timeBetweenChanges < millis()) {
for (int i = 0; i < numRect; i++) {
rectClr[i] = color ( random(255), random(255), random(255) );
rSize[i] = random (150);
rx[i] = random (width);
ry[i] = random (height);
}
lastTimeChanged = millis();
}
}