diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-08-25 12:36:37 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-08-25 12:36:37 +0200 |
| commit | e5de70f2c1dcac767bd34a6b90ac1797a7acb433 (patch) | |
| tree | 25a8c8f339fb5b496b460391ee06a9effeb64855 /lib/screens/sprinkles.js | |
| parent | 6b909d95ec07848136a6f337db28318c1cd46c60 (diff) | |
| parent | d7bc21d19e168f3a99f54e5ba4866ed49f1187f1 (diff) | |
Merge branch 'rust'
Diffstat (limited to 'lib/screens/sprinkles.js')
| -rw-r--r-- | lib/screens/sprinkles.js | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/screens/sprinkles.js b/lib/screens/sprinkles.js deleted file mode 100644 index f12200e..0000000 --- a/lib/screens/sprinkles.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -/** - * Draws random sprinkles in the screen each frame. Same color per - * frame. - * - * @function SprinklesScreen - * @implements IScreen - */ -module.exports = function (modulation, width, height, renderer) { - - let response = ''; - - 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); - - 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) - - response += `${position}${renderer(red, blue, green)} `; - } - - return response; -}; |