if i add so many parenthesis maybe it'll learn
This commit is contained in:
parent
343df4cba5
commit
2ce9ef22ae
1 changed files with 7 additions and 4 deletions
11
lights.js
11
lights.js
|
@ -10,12 +10,15 @@ var next_pattern = new Uint32Array(cfg.leds);
|
||||||
var pattern = {}
|
var pattern = {}
|
||||||
|
|
||||||
function rgb_to_int(r, g, b) {
|
function rgb_to_int(r, g, b) {
|
||||||
return (((r << 8) + g) << 8) + b;
|
let rgb = r;
|
||||||
|
rgb = (rgb << 8) + g;
|
||||||
|
rgb = (rgb << 8) + b;
|
||||||
|
return rgb;
|
||||||
}
|
}
|
||||||
function int_to_rgb(int) {
|
function int_to_rgb(int) {
|
||||||
var r = int >> 16 & 0xFF;
|
var r = (int >> 16) & 0xFF;
|
||||||
var g = int >> 8 & 0xFF;
|
var g = (int >> 8) & 0xFF;
|
||||||
var b = int & 0xFF;
|
var b = (int) & 0xFF;
|
||||||
return { r: r, g: g, b: b };
|
return { r: r, g: g, b: b };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue