xxxxxxxxxx
38
function setup() {
createCanvas(720, 720);
noCursor();
colorMode(HSB, 150, 10, 10);
rectMode(CENTER); // Set rectMode to CENTER for the rectangles
noStroke();
}
// Change the background color based on the mouse's Y position
function draw() {
background(mouseY / 10, 100, 100);
// Main circle fill color and size based on the mouse position
fill(360 - mouseY / 2, 100, 100);
ellipse(360, 360, mouseX + 1, mouseX + 1); // Main circle in the center
// Draw smaller circles in the four corners based on mouse position
fill(360 - mouseY / 4, 80, 80);
ellipse(mouseX / 2, mouseY / 2, 50, 50); // Top-left smaller circle
ellipse(width - mouseX / 2, mouseY / 2, 50, 50); // Top-right smaller circle
ellipse(mouseX / 2, height - mouseY / 2, 50, 50); // Bottom-left smaller circle
ellipse(width - mouseX / 2, height - mouseY / 2, 50, 50); // Bottom-right smaller circle
// Add rectangles at the top middle and middle of left/right walls
fill(360 - mouseY / 3, 100, 80); // Color for the rectangles
rect(width / 2, 50, mouseX + 20, 30); // Top-middle rectangle
rect(50, height / 2, 30, mouseX + 20); // Left-middle rectangle
rect(width - 50, height / 2, 30, mouseX + 20); // Right-middle rectangle
}
// Save the canvas when 's' is pressed
function keyPressed() {
if (key == "s" || key == "S") {
saveCanvas('artwork', 'png');
}
}