Hey! I have been trying for quite some time now to figure out how to hide a slider after it has been shown. I've tried numerous ways but I have not found a solution yet. I would like to archive a code where the slider simply disappear if I hit the green area.
import controlP5.*;
ControlP5 cp5;
void setup() {
size(400,400);
}
void draw() {
fill(255,0,0);
rect(0,0,200,100);
fill(0,255,0);
rect(200,0,200,100);
if (mousePressed) {
if (mouseX > 0 && mouseX < 200 && mouseY > 0 && mouseY < 100) {
cp5 = new ControlP5(this);
cp5.addSlider("slider")
.setPosition(100,150)
.setSize(200,30);
}
}
if (mousePressed) {
if (mouseX > 200 && mouseX < 400 && mouseY > 0 && mouseY < 100) {
}
}
}