Click the buttons, type in the input box, and switch the radio options in the corner. Click the link in the top left for a surprise.
xxxxxxxxxx
let button;
let buttonX = 175;
let buttonY = 195;
let bgColor = 220;
let a;
let inp;
let radio;
let val;
function setup() {
createCanvas(400, 400);
button = createButton('click me');
a = createA('https://theuselessweb.site/bees/', 'or click here');
inp = createInput('');
radio = createRadio();
radio.option('square');
radio.option('circle');
rectMode(CENTER);
}
function draw() {
background(bgColor);
a.position(0, 0);
inp.position(250, 350);
inp.size(100);
inp.input(inputEvent);
button.position(buttonX, buttonY);
button.mousePressed(moveButton);
val = radio.value();
if(val == 'square'){
square(300, 40, 55);
}
if(val == 'circle'){
circle(300, 40, 55);
}
}
function moveButton(){
buttonX = random(0, 350);
buttonY = random(0, 350);
}
function inputEvent(){
bgColor = (random(0, 255), random(0,255), random(0, 255));
}