Setup is intended to run once and will not update canvas as draw() does:
Here is a minimal version to run “something” at start of draw() before looping though main code in draw() :
//boolean choiceMade = false;
boolean startup = true;
boolean displayOnce = true;
void setup()
{
size(300, 150);
textAlign(CENTER, CENTER);
textSize(48);
}
void draw()
{
//Startup code runs once until a key is pressed
if (startup)
{
background(255, 0, 0);
if (keyPressed)
{
//choiceMade = true;
startup = false;
}
text("Press a key", width/2, height/2-10);
return; //https://processing.org/reference/return.html
}
//Main code
background(0, 255, 0);
text("Yay!", width/2, height/2-10);
}
’ ’