]> git.r.bdr.sh - rbdr/tomato-sauce/blame - lib/screens/gradients.js
Adds package.json info
[rbdr/tomato-sauce] / lib / screens / gradients.js
CommitLineData
c7b4bd19
BB
1'use strict';
2
3// Draws moving gradient boxes.
4const Gradients = function (modulation, width, height, renderer) {
5 let response = '';
6
7 for (let i = 0; i < height; i++) {
8 for (let j = 0; j < width; j++) {
9 let red = ((modulation + i) * 255 / height) % 255;
10 let blue = ((modulation + j) * 255 / width) % 255;
11 let green = ((modulation + i * j) * 255 / (width * height)) % 255;
12
13 response = response + renderer(red, blue, green);
14 response = response + ' ';
15 }
16
17 if (i < height - 1) {
18 response = response + '\n';
19 }
20 }
21
22 return response;
23};
24
25module.exports = Gradients;