X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/fd38d4096e65ba5afba8ed1ddc75ed1814ca8c16..a0666be3ab58ed83ad6d622cfe2b8293c40dffbb:/lib/screens/sprinkles.js?ds=inline diff --git a/lib/screens/sprinkles.js b/lib/screens/sprinkles.js index f12200e..9ba1e16 100644 --- a/lib/screens/sprinkles.js +++ b/lib/screens/sprinkles.js @@ -9,24 +9,24 @@ */ module.exports = function (modulation, width, height, renderer) { - let response = ''; + let response = ''; - const maxSprinkleCount = (width * height) / 2; - const minSprinkleCount = (width * height) / 8; - const sprinkleCount = Math.round(Math.random() * (maxSprinkleCount - minSprinkleCount)) + minSprinkleCount; + const maxSprinkleCount = (width * height) / 2; + const minSprinkleCount = (width * height) / 8; + const sprinkleCount = Math.round(Math.random() * (maxSprinkleCount - minSprinkleCount)) + minSprinkleCount; - const red = Math.floor(Math.random() * 255); - const blue = Math.floor(Math.random() * 255); - const green = Math.floor(Math.random() * 255); + const red = Math.floor(Math.random() * 255); + const blue = Math.floor(Math.random() * 255); + const green = Math.floor(Math.random() * 255); - for (let i = 0; i < sprinkleCount; ++i) { - const x = Math.round(Math.random() * (width - 1)) + 1; - const y = Math.round(Math.random() * (height - 1)) + 1; + for (let i = 0; i < sprinkleCount; ++i) { + const x = Math.round(Math.random() * (width - 1)) + 1; + const y = Math.round(Math.random() * (height - 1)) + 1; - const position = `\x1B[${y};${x}H`; // Move cursor to y,x (CSI y;x H) + const position = `\x1B[${y};${x}H`; // Move cursor to y,x (CSI y;x H) - response += `${position}${renderer(red, blue, green)} `; - } + response += `${position}${renderer(red, blue, green)} `; + } - return response; + return response; };