cnv = createCanvas(w, h);
gfx = createGraphics(w/2, h/2);
r = [random(0, 256), random(0, 256), random(0, 256), random(0, 256)];
g = [random(0, 256), random(0, 256), random(0, 256), random(0, 256)];
b = [random(0, 256), random(0, 256), random(0, 256), random(0, 256)];
background(250, 248, 230);
for (let i=0; i<floor(random(2,6)); i++){
gfx.translate(random(0,400), random(0,400));
gfx.rotate(random(0, TWO_PI));
gfx.stroke(r[c], g[c], b[c]);
gfx.ellipse(0, 0, random(0,400), random(0,400));
for (let i=0; i<floor(random(0,2)); i++){
gfx.translate(random(0,400), random(0,400));
gfx.rotate(random(0, TWO_PI));
gfx.stroke(r[c], g[c], b[c]);
gfx.rect(0, 0, random(0,400), random(0,400));
for (let i=0; i<floor(random(2,6)); i++){
gfx.translate(random(0,400), random(0,400));
gfx.rotate(random(0, TWO_PI));
gfx.stroke(r[c], g[c], b[c]);
gfx.line(random(-200,200), random(-200,200), random(0,200), random(0,200));
function mousePressed() {
background(250, 248, 230);
image(gfx, width*0.25, height*0.25, 200, 200);
translate(width*0.75, height*0.25);
image(gfx, 0, 0, 200, 200);
translate(width*0.25, height*0.75);
image(gfx, 0, 0, 200, 200);
translate(width*0.75, height*0.75);
image(gfx, 0, 0, 200, 200);
for (let y = gridsize/2; y < height; y += gridsize) {
for (let x = gridsize/2; x < width; x += gridsize) {
rect(x, y, gridsize, gridsize);