jafal
1
import controlP5.*;
ControlP5 cp5;
Slider boxSize;
Slider2D rotate;
ColorWheel col;
Toggle start;
void setup() {
size(800, 600, P3D);
cp5 = new ControlP5(this);
boxSize = cp5.addSlider("BOX SIZE")
.setPosition(20, 20)
.setRange(0, 400)
.setValue(200);
rotate = cp5.addSlider2D("ROTATION")
.setPosition(20, 40)
.setSize(100, 100)
.setMinMax(1.0, 1.0, 10.0, 10.0)
.setValue(2.0, 2.0);
start = cp5.addToggle("START/STOP")
.setPosition(20, 160)
.setSize(20, 20);
col = cp5.addColorWheel("COLOR")
.setPosition(20, 220)
.setRGB(color(31, 128, 255));
}
void draw() {
background(0);
pushMatrix();
lights();
translate(width/2, height/2, 0);
if (start.getState()) {
rotateX(millis()/1000.0 * rotate.getArrayValue()[0]);
rotateY(millis()/1000.0 * rotate.getArrayValue()[0]);
}
fill(col.getRGB());
noStroke();
box(boxSize.getValue());
popMatrix();
}