/* Steps: play the steps written in the "steps" property, one after another. steps is the steps separated by ";", each the pixels' colours as rrggbb hex separated by ",", left to right and then top to bottom. Missing pixels are off. The matrix's own colour is not used. shows/test.qxw's can patterns use it (scripts/shows/can_patterns.py): each is one RGB matrix running for as long as the pattern does, so a chase started after it lands on top, where a chaser of scenes would start a newer scene every step. With a Mask blend, grey levels dim the colour under it. QLC+ loads it from ~/.qlcplus/rgbscripts, where can_patterns.py links it. */ var testAlgo; ( function() { var algo = new Object; algo.apiVersion = 2; algo.name = "Steps"; algo.author = "qlcplus shows"; algo.acceptColors = 0; algo.properties = new Array(); algo.steps = [[0]]; algo.text = "000000"; algo.properties.push("name:steps|type:string|display:Steps|write:setSteps|read:getSteps"); algo.setSteps = function(_steps) { algo.text = _steps; algo.steps = String(_steps).split(";").map(function(step) { return step.split(",").map(function(hex) { return parseInt(hex, 16) || 0; }); }); }; algo.getSteps = function() { return algo.text; }; algo.rgbMap = function(width, height, rgb, step) { var pixels = algo.steps[step % algo.steps.length]; var map = new Array(height); for (var y = 0; y < height; y++) { map[y] = new Array(width); for (var x = 0; x < width; x++) { var i = y * width + x; map[y][x] = i < pixels.length ? pixels[i] : 0; } } return map; }; algo.rgbMapStepCount = function(width, height) { return algo.steps.length; }; testAlgo = algo; return algo; } )();