import controlP5.*;
ControlP5 cp5;
int myColorBackground = color(0,0,0);
public float numberboxValue = 100;
void setup() {
size(700,400);
noStroke();
cp5 = new ControlP5(this);
cp5.addNumberbox("numberbox")
.setPosition(100,160)
.setSize(100,20)
.setScrollSensitivity(1)//??
.setDirection(Controller.HORIZONTAL) // change the control direction to left/right
.setValue(50)
;
cp5.addNumberbox("numberboxValue")
.setPosition(100,220)
.setSize(100,20)
.setRange(0,200)
.setMultiplier(1) // set the sensitifity of the numberbox敏感性
.setDirection(Controller.HORIZONTAL) // change the control direction to left/right
.setValue(100)
;
}
void draw() {
background(myColorBackground);
fill(numberboxValue,0,0);
rect(0,0,h,100);
}
int h;
void numberbox(int theColor) { //即numberbox的TheValue
myColorBackground = color(theColor);
h = theColor;
println("a numberbox event. setting background to "+theColor);
}```
02-27
1429

04-23
1505
