X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/c7b4bd19a006d61c3b4979e884370d123cec7524..refs/heads/rbdr-update:/lib/screens/sprinkles.js

diff --git a/lib/screens/sprinkles.js b/lib/screens/sprinkles.js
index 446f46e..9ba1e16 100644
--- a/lib/screens/sprinkles.js
+++ b/lib/screens/sprinkles.js
@@ -1,28 +1,32 @@
 'use strict';
 
-// Places random sprinkles in the screen each frame. Same color per
-// frame.
-const Sprinkles = function (modulation, width, height, renderer) {
-  let response = '';
+/**
+ * Draws random sprinkles in the screen each frame. Same color per
+ * frame.
+ *
+ * @function SprinklesScreen
+ * @implements IScreen
+ */
+module.exports = function (modulation, width, height, renderer) {
 
-  let maxSprinkleCount = (width * height) / 2;
-  let minSprinkleCount = (width * height) / 8;
-  let sprinkleCount = Math.round(Math.random() * (maxSprinkleCount - minSprinkleCount)) + minSprinkleCount;
+    let response = '';
 
-  let red = Math.floor(Math.random() * 255);
-  let blue = Math.floor(Math.random() * 255);
-  let green = Math.floor(Math.random() * 255);
+    const maxSprinkleCount = (width * height) / 2;
+    const minSprinkleCount = (width * height) / 8;
+    const sprinkleCount = Math.round(Math.random() * (maxSprinkleCount - minSprinkleCount)) + minSprinkleCount;
 
-  for (let i = 0; i < sprinkleCount; i++) {
-    let x = Math.round(Math.random() * (width - 1)) + 1;
-    let y = Math.round(Math.random() * (height - 1)) + 1;
+    const red = Math.floor(Math.random() * 255);
+    const blue = Math.floor(Math.random() * 255);
+    const green = Math.floor(Math.random() * 255);
 
-    let position = `\x1B[${y};${x}H`; // Move cursor to y,x (CSI y;x H)
+    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;
 
-    response += `${position}${renderer(red, blue, green)} `;
-  }
+        const position = `\x1B[${y};${x}H`; // Move cursor to y,x (CSI y;x H)
 
-  return response;
-};
+        response += `${position}${renderer(red, blue, green)} `;
+    }
 
-module.exports = Sprinkles;
+    return response;
+};