Update webserial default code
This commit is contained in:
parent
4cb1f6ea4d
commit
90db3e61f5
@ -98,51 +98,69 @@ class MovingHead extends Fixture implements GenericRGBW {
|
||||
}
|
||||
}
|
||||
|
||||
class Flower extends Fixture implements GenericRGBW {
|
||||
|
||||
setBrightness(value: number, strobe?: boolean): void {
|
||||
// dimmer seems unsupported :(
|
||||
this.setChannel(7, (strobe || false) ? 255 * value : 0);
|
||||
}
|
||||
|
||||
setRGBW(rgb: [number, number, number], w?: number): void {
|
||||
const [r, g, b] = rgb;
|
||||
this.setChannel(1, r);
|
||||
this.setChannel(2, g);
|
||||
this.setChannel(3, b);
|
||||
this.setChannel(4, w || 0);
|
||||
}
|
||||
|
||||
setAP(a: number, p: number) {
|
||||
this.setChannel(5, a);
|
||||
this.setChannel(6, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the rotation speed
|
||||
* @param speed Between -1 (clockwise) and 1 (counterclockwise)
|
||||
*/
|
||||
setRotation(direction: number) {
|
||||
const val = (direction < 0)
|
||||
? /* clockwise */ lib.remap(direction, [0, -1], [0, 128], true)
|
||||
: /* counterclockwise */ lib.remap(direction, [0, 1], [129, 255], true);
|
||||
|
||||
this.setChannel(8, val);
|
||||
}
|
||||
|
||||
setMacro(pattern: number, speed: number) {
|
||||
this.setChannel(9, pattern);
|
||||
this.setChannel(10, speed);
|
||||
}
|
||||
|
||||
}
|
||||
// class Flower extends Fixture implements GenericRGBW {
|
||||
//
|
||||
// setBrightness(value: number, strobe?: boolean): void {
|
||||
// // dimmer seems unsupported :(
|
||||
// this.setChannel(7, (strobe || false) ? 255 * value : 0);
|
||||
// }
|
||||
//
|
||||
// setRGBW(rgb: [number, number, number], w?: number): void {
|
||||
// const [r, g, b] = rgb;
|
||||
// this.setChannel(1, r);
|
||||
// this.setChannel(2, g);
|
||||
// this.setChannel(3, b);
|
||||
// this.setChannel(4, w || 0);
|
||||
// }
|
||||
//
|
||||
// setAP(a: number, p: number) {
|
||||
// this.setChannel(5, a);
|
||||
// this.setChannel(6, p);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Set the rotation speed
|
||||
// * @param speed Between -1 (clockwise) and 1 (counterclockwise)
|
||||
// */
|
||||
// setRotation(direction: number) {
|
||||
// const val = (direction < 0)
|
||||
// ? /* clockwise */ lib.remap(direction, [0, -1], [0, 128], true)
|
||||
// : /* counterclockwise */ lib.remap(direction, [0, 1], [129, 255], true);
|
||||
//
|
||||
// this.setChannel(8, val);
|
||||
// }
|
||||
//
|
||||
// setMacro(pattern: number, speed: number) {
|
||||
// this.setChannel(9, pattern);
|
||||
// this.setChannel(10, speed);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// ******************
|
||||
// * CODE GOES HERE *
|
||||
// ******************
|
||||
|
||||
let color = lib.hsl2rgb(360 * t, 100, 50);
|
||||
let color = lib.hsl2rgb(360 * (t / 7), 100, 50);
|
||||
|
||||
let par = new Par(1);
|
||||
par.setBrightness(1);
|
||||
par.setRGBW(color);
|
||||
const pars = [
|
||||
new Par(1),
|
||||
new Par(41),
|
||||
];
|
||||
|
||||
const heads = [
|
||||
new MovingHead(120),
|
||||
new MovingHead(140),
|
||||
new MovingHead(160),
|
||||
new MovingHead(100),
|
||||
];
|
||||
|
||||
for (let par of pars) {
|
||||
par.setBrightness(1);
|
||||
par.setRGBW(color);
|
||||
}
|
||||
|
||||
for (let head of heads) {
|
||||
head.setBrightness(1);
|
||||
head.setRGBW(color);
|
||||
}
|
Loading…
Reference in New Issue
Block a user