diff --git a/lights.js b/lights.js index 644862c..5902e62 100644 --- a/lights.js +++ b/lights.js @@ -9,6 +9,7 @@ const log = new Logger( ); const fade_ticks = cfg.fade_ticks || 20; +var num_ticks = 0; var pixels = new Uint32Array(cfg.leds); var pixel_cache = new Uint32Array(cfg.leds); var next_pattern = new Uint32Array(cfg.leds); @@ -113,15 +114,25 @@ export const functions = { convert_args: true, } ), - slide: new Function( + stagger: new Function( (index, arg1, arg2) => { - return index + arg2; + return (index + arg2) % 255; }, { requires_arg1: true, requires_arg2: 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 { getRandom(); } + num_ticks++; } function getRandom() {