How can I change Image background with mouse click?

Hi @steven,

you can use the same approch as from your other topic…

but instead of changing the background, switch on and off the text output …

Cheers
— mnse

PS:

final String myMessage="Hello World!";
int nextOne = 0;
boolean showText = false;

void setup() {
  size(500, 500);
  textSize(50);
  fill(255);
  textAlign(CENTER, CENTER);
}

void draw() {
  background(0);
  if (millis() > nextOne) {
    showText = !showText;
    nextOne = millis() + floor(map(mouseX, 0, width, 500, 50));
  }
  if (showText)
    text(myMessage, width/2, height/2);
}