xxxxxxxxxx
24
// How to make a rectangular vs circular button
function setup() {
createCanvas(400, 400);
textAlign(CENTER);
}
function draw() {
background(0);
if(mouseX>100 && mouseX<150 && mouseY>200 && mouseY<250 && mouseIsPressed) {
background('orange');
}
fill('cyan');
ellipse(100, 100, 50);
if(dist(100, 100, mouseX, mouseY) < 25 && mouseIsPressed) {
fill('red');
textSize(20);
text("Hi!", 100, 100);
}
fill('yellow');
rect(100, 200, 50, 50);
}