How to make a picture disappear after tap a key or click the mosuse

How to make a picture disappear after tap a key or click the mouse?

Looking forward your reply! Thanks!

Hi, you need to create a bool variable and use that to draw.
say:
in ofApp.h you have:

ofImage img;
bool drawMyImage = true;

in ofApp.cpp


void ofApp::draw(){
if(drawMyImage){
img.draw();
}
}

void ofApp::mouseReleased(int x, int y, int button){
drawMyImage = !drawMyImage;
}

You are so nice!Thanks very much!

1 Like