summaryrefslogtreecommitdiff
path: root/lib/screens/sprinkles.js
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2021-12-24 13:54:43 +0100
committerRuben Beltran del Rio <ruben@unlimited.pizza>2021-12-24 13:54:43 +0100
commita0666be3ab58ed83ad6d622cfe2b8293c40dffbb (patch)
treee2688587db986a3bc4b040dce1041dac3b352a80 /lib/screens/sprinkles.js
parentc80b2f4575cfc3d74ec8e0b112943cbd081ffcd7 (diff)
Update code and dpendencies
Diffstat (limited to 'lib/screens/sprinkles.js')
-rw-r--r--lib/screens/sprinkles.js28
1 files changed, 14 insertions, 14 deletions
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;
};