summaryrefslogtreecommitdiff
path: root/lib/screens/mirrors.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/screens/mirrors.js')
-rw-r--r--lib/screens/mirrors.js44
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/screens/mirrors.js b/lib/screens/mirrors.js
index e842217..4f29c7d 100644
--- a/lib/screens/mirrors.js
+++ b/lib/screens/mirrors.js
@@ -8,33 +8,33 @@
*/
module.exports = function (modulation, width, height, renderer) {
- const response = [];
+ const response = [];
- const scale = 2 + Math.round(Math.random() * 4);
- const scaledHeight = Math.floor(height / scale);
- const scaledWidth = Math.floor(width / scale);
+ 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;
+ 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(''));
- }
+ const cell = [renderer(red, blue, green), ' '];
+ row.push(cell.join(''));
+ }
- let rowText = '';
- for (let j = 0; j < scale; ++j) {
- rowText += row.reverse().join('');
- }
+ let rowText = '';
+ for (let j = 0; j < scale; ++j) {
+ rowText += row.reverse().join('');
+ }
- for (let j = 1; j < scale; ++j) {
- response[j * i] = rowText;
- response[(height - 1 - (j * i))] = rowText;
+ for (let j = 1; j < scale; ++j) {
+ response[j * i] = rowText;
+ response[(height - 1 - (j * i))] = rowText;
+ }
}
- }
- return response.join('\n');
+ return response.join('\n');
};