xxxxxxxxxx
31
function setup() {
createCanvas(400, 400);
strokeWeight(4);
stroke('white');
}
function draw() {
background(0);
button(200, 200, 50, '#FFC107');
button(100, 100, 100, 'rgb(252,53,252)');
button(270, 250, 100, 'rgb(0,234,255)');
button(50, 50, 20, 'rgb(71,243,71)');
}
function button(x, y, s, c){
var d = dist(mouseX, mouseY, x, y);
if (d < s / 1) {
fill(c);
} else{
fill('red');
}
//fill('#FFC107');
rect(x, y, s, 55, 20);
}