xxxxxxxxxx
46
/*
Inspired by "rectangular forms" by the Belfort Group
Published in Computer Graphics and Art, 1976, Vol. 1, No. 3
*/
let cellSize;
function setup() {
createCanvas(windowWidth, windowHeight);
noStroke();
}
function draw() {
background(0); //changed background to black
cellSize = min(width / 40, height / 40); //changed cellsize to be smaller
for (let x = 0; x < width; x += cellSize) {
for (let y = 0; y < height; y += cellSize) {
let chance = random(100); //changed chance value
if (chance < 20) {
fill(random(250),random(250),random(250));
} else {
fill(0);
}
square(x, y, cellSize);
}
}
// noLoop();
}
// // function mouseDragged() {
// loop();
// // }
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
function keyPressed(){
if(key=='s')
saveGif('animation.gif',5);
}