You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.2 KiB
65 lines
1.2 KiB
|
|
// float[] COLOR={60,10,0};
|
|
float border=4;
|
|
|
|
class Light{
|
|
int start_channel;
|
|
float dest_value;
|
|
float value;
|
|
float last_time;
|
|
float phi;
|
|
|
|
|
|
Light(int channel_){
|
|
start_channel=channel_;
|
|
value=light_min;
|
|
|
|
last_time=millis();
|
|
|
|
phi=random(100);
|
|
}
|
|
|
|
|
|
void update(){
|
|
|
|
|
|
}
|
|
|
|
void reset(){
|
|
setColor(0);
|
|
}
|
|
|
|
void setColor(float val){
|
|
|
|
dest_value=val;
|
|
// for(int i=0;i<3;++i){
|
|
// dmxOutput.set(start_channel+i,int(val*COLOR[i]));
|
|
// }
|
|
|
|
int output_value=constrain(int(val*(light_max-light_min)+light_min), 0,255);
|
|
|
|
for(int i=0;i<REPEAT_CHANNEL;++i){
|
|
dmxOutput.set(start_channel+i, output_value);
|
|
}
|
|
//dmxOutput.set(start_channel+1, constrain(int(val*color_ww),0,255));
|
|
//dmxOutput.set(start_channel+2,0);
|
|
}
|
|
|
|
void draw(float x, float y, float w, float h){
|
|
int val_draw=int(dest_value*(light_max-light_min)+light_min);
|
|
//println(val_draw);
|
|
|
|
|
|
pushStyle();
|
|
fill(val_draw);
|
|
stroke(255);
|
|
rect(x+border,y+border,w-border*2,h-2*border);
|
|
|
|
fill(255);
|
|
textSize(24);
|
|
textAlign(CENTER);
|
|
//text(nfc(value,2), x+w/2,y+h/2);
|
|
text(nfc(dest_value,3), x+w/2,y+h/2);
|
|
popStyle();
|
|
}
|
|
}
|
|
|