ICM // Peachy Hospital

Here’s me restructuring code by creating functions for each aspect of the visuals (also, the editor randomly named this “Peachy Hospital” which seems kind of perfect:

I was trying to figure out how to scale up the pawprints so it could randomly generate bigger or smaller ones, but this seemed almost impossible would grouping all of its components into one object (which I feel like I haven’t quite learned how to do yet?? maybe?) code below!

function setup() {
createCanvas(400, 400);
background(255, 230, 230);
}

function draw() {
squares();
}

function mousePressed() {
//background(255, 230, 230);
pawprint();
}

function pawprint() {
noStroke();
fill(random(100, 255), 0, random(100, 150), 100);
size = 8;
ellipse(mouseX, mouseY, size * 3, size * 3);
ellipse(mouseX + 18, mouseY – 5, size, size);
ellipse(mouseX + 12, mouseY – 15, size, size);
ellipse(mouseX, mouseY – 19, size, size);
ellipse(mouseX – 12, mouseY – 15, size, size);
}

function squares() {
noFill();
let color1 = map(mouseY, height, 0, 0, 255);
let color2 = map(mouseX, 0, width, 0, 255);
stroke(color1, color2, color1);

for (let y = height + 8; y >= mouseY; y -= 25) {
for (let x = 7; x <= mouseX; x += 25) {
rect(x, y, 10, 10);
}
}
}