Dual sided controlP5 Slider
in
Contributed Library Questions
•
11 months ago
Hi! Any help is GREATLY appreciated! I am using the controlP5 slider and I want to be able to move both sides of the slider so that I can allow the user to manipulate a RANGE.
(i.e. Slider is 1-10 and I want user to be able to manipulate slider so that range is 3-6.)
Here is the code.... it is just the stuff from CP5. Thank you!
///////////////////////////////////////////////////////
import controlP5.*;
ControlP5 cp5;
int myColor = color(0,0,0);
void setup() {
size(700,200);
noStroke();
cp5 = new ControlP5(this);
// add a vertical slider
cp5.addSlider("slider")
.setPosition(100,25)
.setSize(200,20)
.setRange(0,200)
.setValue(128)
;
}
void draw() {
fill(myColor);
rect(0,100,width,70);
}
void slider(float theColor) {
myColor = color(theColor);
println("a slider event. setting background to "+theColor);
}
(i.e. Slider is 1-10 and I want user to be able to manipulate slider so that range is 3-6.)
Here is the code.... it is just the stuff from CP5. Thank you!
///////////////////////////////////////////////////////
import controlP5.*;
ControlP5 cp5;
int myColor = color(0,0,0);
void setup() {
size(700,200);
noStroke();
cp5 = new ControlP5(this);
// add a vertical slider
cp5.addSlider("slider")
.setPosition(100,25)
.setSize(200,20)
.setRange(0,200)
.setValue(128)
;
}
void draw() {
fill(myColor);
rect(0,100,width,70);
}
void slider(float theColor) {
myColor = color(theColor);
println("a slider event. setting background to "+theColor);
}
1