// A drawing tool that can draft random floor plans
float c1 = 0;
float c2 = 0;
float c3 = 0;
float c4 = 0;
void setup () {
size (400,400);
frameRate(30);
background(255);
smooth();
noStroke();
}
// random green rects when mouse is pressed
void draw() {
if (mousePressed == true) {
c1 = random(-20, 40);
c2 = random(-10, 40);
fill (200, 255, 0);
rect(mouseX,mouseY, c1, c2);
// random grey rects when mouse is not pressed
} else {
c3 = random(-5, 20);
c4 = random(-10, 20);
fill (50);
rect(mouseX,mouseY, c3, c4);
}
}
// clear screen
void keyPressed () {
if (key == 'c' || key == 'C') {
setup();
}
}Scott - E
on Tuesday, Oct 14, 2008 – 11:12 pm
2 Comments
This has a good range of control and chaos. Do you have ideas about how it could be extended?
i could perhaps account for the speed of the mouse…