fullscreen //object constructors:
// enviroment setup :
void setup() {
size(1000,400);
background(0);
stroke(255);
smooth();
}
// df variables :
float s;
// functions :
void f_center() { // move to center of frame
translate(width/2,height/2);
}
void f_tHatch_001a(float d) {
d *= 0.66f;
if (d > 2) {
pushMatrix();
line(0,0,0,d);
rotate(radians(random(60,180)));
line(0,0,0,d/2);
translate(0,d/2);
f_tHatch_001a(d);
//popMatrix();
translate(0,d);
f_tHatch_001a(d);
popMatrix();
pushMatrix();
line(0,0,0,-d);
rotate(radians(random(60,180)));
line(0,0,0,-d/2);
translate(0,-d/2);
f_tHatch_001a(-d);
//popMatrix();
translate(0,-d);
f_tHatch_001a(-d);
popMatrix();
}
}
// run :
void draw() {
f_center();
if (s < 1) {
s = width;
translate(0,0);
} else if (s >= 1) {
translate(random(-width/2,width/2),random(-height/2,height/2));
}
int clr = int(random(0,2.3));
switch(clr) {
case 0 : // clr match 0
stroke(0);
break;
case 1 : // clr match 1
stroke(255);
break;
default : // no match
stroke(255);
break;
}
f_tHatch_001a(-s/2);
f_tHatch_001a(s/2);
noLoop(); // stop executing
}
// interactions :
void mousePressed() {
if (width > height) {
s = mouseX*2;
} else if (width < height) {
s = mouseY*2;
} else if (width == height) {
s = (mouseX-width/2)*(mouseY-height/2);
}
redraw();
}
void keyReleased() {
saveFrame("tHatch001a-####.tga");
}
very simple script with quite interesting results - just keep clicking on stage