xxxxxxxxxx
let circleSize = 60;
function setup() {
createCanvas(windowWidth, windowHeight);
background(130, 80, 130);
}
function draw() {
if (keyIsPressed == true) {
background(130, 80, 130);
}
// check which side of the cavas the mouse is on
if (mouseX < width / 2) {
circleSize = 80;
} else {
circleSize = 20;
}
if (mouseIsPressed == true) {
noStroke();
fill(random(10, 100));
circle(mouseX, mouseY, circleSize);
}
fill(255);
textSize(30);
text("click and drag to draw\npress space to clear",20,50);
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}