X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/c7b4bd19a006d61c3b4979e884370d123cec7524..a0666be3ab58ed83ad6d622cfe2b8293c40dffbb:/lib/screens/gradients.js diff --git a/lib/screens/gradients.js b/lib/screens/gradients.js index 5e63d5b..9694fc6 100644 --- a/lib/screens/gradients.js +++ b/lib/screens/gradients.js @@ -1,25 +1,29 @@ 'use strict'; -// Draws moving gradient boxes. -const Gradients = function (modulation, width, height, renderer) { - let response = ''; +/** + * Draws moving gradient boxes + * + * @function GradientsScreen + * @implements IScreen + */ +module.exports = function (modulation, width, height, renderer) { - for (let i = 0; i < height; i++) { - for (let j = 0; j < width; j++) { - let red = ((modulation + i) * 255 / height) % 255; - let blue = ((modulation + j) * 255 / width) % 255; - let green = ((modulation + i * j) * 255 / (width * height)) % 255; + let response = ''; - response = response + renderer(red, blue, green); - response = response + ' '; - } + for (let i = 0; i < height; ++i) { + for (let j = 0; j < width; ++j) { + const red = ((modulation + i) * 255 / height) % 255; + const blue = ((modulation + j) * 255 / width) % 255; + const green = ((modulation + i * j) * 255 / (width * height)) % 255; + + response = response + renderer(red, blue, green); + response = response + ' '; + } - if (i < height - 1) { - response = response + '\n'; + if (i < height - 1) { + response = response + '\n'; + } } - } - return response; + return response; }; - -module.exports = Gradients;