// Starter Code for "Embedded Iteration + Randomness" used from Woodpress site
var boolDoRefresh;
function setup() {
createCanvas(400, 400);
background(255, 128, 0);
noStroke();
boolDoRefresh = true;
}
function draw() {
var squareSpacing = 40
if (boolDoRefresh) {
clear();
background(255, 128, 0);
for (var x = 5; x <= width - 10; x += squareSpacing) {
for (var y = 5; y <= height - 10; y += squareSpacing) {
var shape = random(0, 100);
fill(0, 111, 255);
if (shape > 95) {
fill(0, 255, 31);
ellipse(x + 15, y + 15, 30, 30);
}
else {
rect(x, y, 30, 30);
}
}
}
boolDoRefresh = false;
}
}
function mousePressed() {
boolDoRefresh = true;
} |
// Starter Code for "Embedded Iteration + Randomness" used from Woodpress site
var boolDoRefresh;
function setup() {
createCanvas(400, 400);
background(255, 128, 0);
noStroke();
boolDoRefresh = true;
}
function draw() {
var squareSpacing = 40
if (boolDoRefresh) {
clear();
background(255, 128, 0);
for (var x = 5; x <= width - 10; x += squareSpacing) {
for (var y = 5; y <= height - 10; y += squareSpacing) {
var shape = random(0, 100);
fill(0, 111, 255);
if (shape > 95) {
fill(0, 255, 31);
ellipse(x + 15, y + 15, 30, 30);
}
else {
rect(x, y, 30, 30);
}
}
}
boolDoRefresh = false;
}
}
function mousePressed() {
boolDoRefresh = true;
}