1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import controlP5.*;
ControlP5 controlP5;
int myColorBackground = color(0,0,0);
int knobValue = 100;
void setup() {
size(400,400);
smooth();
controlP5 = new ControlP5(this);
controlP5.addKnob("knob",100,200,128,100,160,40);
controlP5.addKnob("knobValue",0,255,128,100,240,40);
}
void draw() {
background(myColorBackground);
fill(knobValue);
rect(0,0,width,100);
}
void knob(int theColor) {
myColorBackground = color(theColor);
println("a knob event. setting background to "+theColor);
}
|