xxxxxxxxxx
int numLines= 20;
float [] lx1 = new float [numLines];
float [] ly1 = new float [numLines];
//// To give each line a new Random color
//color [] lClr = new color [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;
void setup() {
size (500, 700);
smooth();
//Initialising Lines
for (int i = 0; i < numLines; i++ ) {
lx1[i] = random(width);
ly1[i] = random (height);
//// this would give all lines a random color
//lClr[i] = color (random(255), random(255), random(255));
}
//Initialising Rectangles
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);
// Rects
strokeWeight(2);
stroke(0);
for (int i = 0; i < numRect; i++) {
fill (rectClr[i]);
rect (rx[i], ry[i], rSize[i], rSize[i]);
}
// Lines
strokeWeight(1);
stroke(255);
for (int i = 0; i < numLines; i++) {
//stroke(lClr[i]);
line (lx1[i], ly1[i], mouseX, mouseY);
}
}
void mousePressed () {
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);
//saveFrame();
}
}