]> git.r.bdr.sh - rbdr/tomato-sauce/blobdiff - lib/screens/mirrors.js
Update Documentation
[rbdr/tomato-sauce] / lib / screens / mirrors.js
index d683fb63c2d165b7eb0b2ab84e47f9d24537ac3b..e8422177cafafef3408f09cf347792f928a59647 100644 (file)
@@ -1,30 +1,36 @@
 'use strict';
 
-// Draws small moving gradient boxes and repeats them.
-const Mirrors = function (modulation, width, height, renderer) {
-  let response = [];
-
-  let scale = 2 + Math.round(Math.random() * 4);
-  let scaledHeight = Math.floor(height / scale);
-  let scaledWidth = Math.floor(width / scale);
-
-  for (let i = 0; i < scaledHeight; i++) {
-    let row = [];
-    for (let j = 0; j < scaledWidth; 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 cell = [renderer(red, blue, green), ' '];
+/**
+ * Draws small moving gradient boxes and repeats them.
+ *
+ * @function MirrorsScreen
+ * @implements IScreen
+ */
+module.exports = function (modulation, width, height, renderer) {
+
+  const response = [];
+
+  const scale = 2 + Math.round(Math.random() * 4);
+  const scaledHeight = Math.floor(height / scale);
+  const scaledWidth = Math.floor(width / scale);
+
+  for (let i = 0; i < scaledHeight; ++i) {
+    const row = [];
+    for (let j = 0; j < scaledWidth; ++j) {
+      const red = ((modulation + i) * 255 / height) % 255;
+      const blue = ((modulation + j) * 255 / width) % 255;
+      const green = ((modulation + i * j) * 255 / (width * height)) % 255;
+
+      const cell = [renderer(red, blue, green), ' '];
       row.push(cell.join(''));
     }
 
     let rowText = '';
-    for (let j = 0; j < scale; j++) {
+    for (let j = 0; j < scale; ++j) {
       rowText += row.reverse().join('');
     }
 
-    for (let j = 1; j < scale; j++) {
+    for (let j = 1; j < scale; ++j) {
       response[j * i] = rowText;
       response[(height - 1 - (j * i))] = rowText;
     }
@@ -32,5 +38,3 @@ const Mirrors = function (modulation, width, height, renderer) {
 
   return response.join('\n');
 };
-
-module.exports = Mirrors;