X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/fd38d4096e65ba5afba8ed1ddc75ed1814ca8c16..a0666be3ab58ed83ad6d622cfe2b8293c40dffbb:/lib/screens/circle.js?ds=inline diff --git a/lib/screens/circle.js b/lib/screens/circle.js index 720e250..d09cb07 100644 --- a/lib/screens/circle.js +++ b/lib/screens/circle.js @@ -8,29 +8,29 @@ */ module.exports = function (modulation, width, height, renderer) { - const response = []; + let response = ''; - const circles = width > height ? height : width; + const circles = width > height ? height : width; - for (let i = 0; i < circles; ++i) { - const centerX = Math.round(width / 2) + 1; - const centerY = Math.round(height / 2) + 1; + for (let i = 0; i < circles; ++i) { + const centerX = Math.round(width / 2) + 1; + const centerY = Math.round(height / 2) + 1; - const red = Math.floor(Math.random() * 255); - const blue = Math.floor(Math.random() * 255); - const green = Math.floor(Math.random() * 255); + const red = Math.floor(Math.random() * 255); + const blue = Math.floor(Math.random() * 255); + const green = Math.floor(Math.random() * 255); - for (let j = 0; j < 180; ++j) { - const angle = 2 * j * (Math.PI / 180); - const x = Math.round(centerX + Math.sin(angle) * i); - const y = Math.round(centerY + Math.cos(angle) * i); + for (let j = 0; j < 180; ++j) { + const angle = 2 * j * (Math.PI / 180); + const x = Math.round(centerX + Math.sin(angle) * i); + const y = Math.round(centerY + Math.cos(angle) * i); - if (x <= width && x > 0 && y <= height && y > 0) { - const position = `\x1B[${y};${x}H`; // Move cursor to y,x (CSI y;x H) - response += `${position}${renderer(red, blue, green)} `; - } + if (x <= width && x > 0 && y <= height && y > 0) { + const position = `\x1B[${y};${x}H`; // Move cursor to y,x (CSI y;x H) + response += `${position}${renderer(red, blue, green)} `; + } + } } - } - return response; + return response; };