xxxxxxxxxx
37
let buttonX;
let buttonY;
function setup() {
createCanvas(1000, 1000);
buttonX = 450;
buttonY = 550
}
function draw() {
background(240);
textSize(25);
text("This is a Predtictor. The screen below flashes green exactly 1.00000 seconds BEFORE you press the button. Try it.", 100, 100, 800);
fill(255);
stroke(0);
rect(100, 200, 800, 300);
noStroke()
fill(0);
rect(buttonX + 5, buttonY + 5, 100, 50, 10);
stroke(0);
strokeWeight(3);
fill(150, 255, 150);
rect(buttonX, buttonY, 100, 50, 10);
noStroke();
fill(0);
text("Button", buttonX + 13, buttonY + 33);
if (dist(mouseX, mouseY, buttonX + 50, buttonY + 25) < 100) {
buttonX = random(50, 850);
buttonY = random(550, 900);
}
}