xxxxxxxxxx
let Color1;
let Color2;
function setup() {
createCanvas(800, 800);
Color1 = color('black');
Color2 = color('black');
}
function draw() {
background(300);
// Draw the circle
fill(Color1);
stroke('white');
strokeWeight(3);
circle(400, 400, 600);
// Draw the rectangle
fill(Color2);
stroke('white');
strokeWeight(3);
rect(300, 300, 200, 200);
// Draw the vertical lines
for (let i = 20; i < width; i += 20) {
line(i, 20, i, height - 20);
}
}
function keyPressed() {
if (keyCode === LEFT_ARROW) {
Color1 = color('black');
Color2 = color('white');
} else if (keyCode === RIGHT_ARROW) {
Color1 = color('white');
Color2 = color('black');
}
}