Compare commits

..

1 commit

Author SHA1 Message Date
901f23feae add slide function 2021-10-08 01:05:50 -04:00

View file

@ -9,6 +9,7 @@ const log = new Logger(
); );
const fade_ticks = cfg.fade_ticks || 20; const fade_ticks = cfg.fade_ticks || 20;
var num_ticks = 0;
var pixels = new Uint32Array(cfg.leds); var pixels = new Uint32Array(cfg.leds);
var pixel_cache = new Uint32Array(cfg.leds); var pixel_cache = new Uint32Array(cfg.leds);
var next_pattern = new Uint32Array(cfg.leds); var next_pattern = new Uint32Array(cfg.leds);
@ -113,15 +114,25 @@ export const functions = {
convert_args: true, convert_args: true,
} }
), ),
slide: new Function( stagger: new Function(
(index, arg1, arg2) => { (index, arg1, arg2) => {
return index + arg2; return (index + arg2) % 255;
}, },
{ {
requires_arg1: true, requires_arg1: true,
requires_arg2: true, requires_arg2: true,
convert_args: true, convert_args: true,
} },
slide: new Function(
(index, arg1, arg2) => {
return (num_ticks + arg2) % 255;
},
{
requires_arg1: true,
requires_arg2: true,
convert_args: true
}
)
), ),
}; };
@ -171,6 +182,7 @@ function tick_pattern() {
} else { } else {
getRandom(); getRandom();
} }
num_ticks++;
} }
function getRandom() { function getRandom() {