xxxxxxxxxx
//Clair(sijing) Sun
//sijings@andrew.cmu.edu
//Assignment-04-A
// Starter Code for "Embedded Iteration + Randomness"
var boolDoRefresh;
var gridSize = 42;
function setup() {
createCanvas(400, 400);
boolDoRefresh = true;
}
function draw() {
if (boolDoRefresh) {
background(255);
for (var x = gridSize; x <= width - gridSize; x += gridSize) {
for (var y = gridSize; y <= height - gridSize; y += gridSize) {
fill(189,211,221);
noStroke();
if (random(-10,10) > 8){
fill(117,135.142);
ellipse (x+17, y+17, 30,30);
} else {rect(x-1, y-1, 35, 35)}
}
}
boolDoRefresh = false;
}
}
function mousePressed() {
boolDoRefresh = true;
}