xxxxxxxxxx
//Patterns within patterns, aka recursion
function setup() {
simple();
rectMode(CENTER);
//background(10);
}
function draw() {
fill(255, 0, 0, 30);
strokeWeight(1);
//stroke(255, 0, 0, 200);
my_pattern(400, 300, 300);
}
function my_pattern(x, y, s) {
square(x, y, s);
if (s>20) {
if(randomNumber(0,1)==0) {
my_pattern(x-s/4, y-s/4, s/2);
my_pattern(x+s/4, y+s/4, s/2);
} else {
my_pattern(x-s/4, y+s/4, s/2);
my_pattern(x+s/4, y-s/4, s/2);
}
}
}