Greetings
I'm quite new to processing and ran into trouble with using the ControlP5 library.
I'm still in the state of experimenting and tried to change the controlP5-basic example.
I wanted to make a toggle-button that changes the transparency of every element. Including the button.
Code:import controlP5.*;
ControlP5 controlP5;
int visOpaque = 255;
int ColorSquare = 200;
int ColorRect = 0;
int ColorBackground = 100;
int ColorToggle = color(253,228,55, visOpaque);
int ColorActive = color(244,249,250);
boolean globalTrans = false;
void setup() {
size(400,200);
frameRate(25);
controlP5 = new ControlP5(this);
controlP5.addToggle("toggleGlobalTrans",true,10,10,40,40).setColorActive(ColorActive);
}
void draw() {
background(ColorBackground);
fill(ColorSquare);
rect(200,50,100,100);
fill(ColorRect,visOpaque);
rect(0,0,width,100);
}
void toggleGlobalTrans(boolean globalTrans) {
if(globalTrans==false) {
visOpaque = 200;
controlP5.setColorForeground(ColorToggle); //<--- ???
} else {
visOpaque = 255;
controlP5.setColorForeground(ColorToggle);
}
}
But I don't know how to give the changed color-value to the controlP5-controller because it needs integer-values.
I hope I could discribe the problem so you get what I mean & of course that the question is not that stupid.
As I said I'm a real beginner