Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updateHSV(hue,sat,val)
{
if (typeof val !== 'undefined' && val != "")
this.bright = parseInt(val);
this.hsb.h = parseInt(hue);
this.hsb.s = parseInt(sat);
this.hsb.b = this.bright;
let rgb = Color.hsv([this.hsb.h,this.hsb.s,this.hsb.b]).rgb();
this.rgb.r = rgb.color[0];
this.rgb.g = rgb.color[1];
this.rgb.b = rgb.color[2];
//console.log("updateByRGB => new rgb: ",this.rgb);
this.emit('stateUpdate',this);
}
setHSV(hsv,duration)
{
let color = Color.hsv(hsv);
let hue = color.hue();
let sat = color.saturationv();
let bright = color.value();
//update local state
this.updateHSV(hue,sat,bright);
//"hue", "sat", "effect", "duration"
let params =
[
hue,
sat,
(duration) ? "smooth" : "sudden",
(duration) ? duration : 0
];