--- /dev/null
+'use strict';
+
+// Draws concentric circles. Each ring has its own color.
+const Circle = function (modulation, width, height, renderer) {
+ let response = [];
+
+ let circles = width > height ? height : width;
+
+ for (let i = 0; i < circles; i++) {
+ let centerX = Math.round(width / 2) + 1;
+ let centerY = Math.round(height / 2) + 1;
+
+ let red = Math.floor(Math.random() * 255);
+ let blue = Math.floor(Math.random() * 255);
+ let green = Math.floor(Math.random() * 255);
+
+ for (let j = 0; j < 180; j++) {
+ let angle = 2 * j * (Math.PI / 180);
+ let x = Math.round(centerX + Math.sin(angle) * i);
+ let y = Math.round(centerY + Math.cos(angle) * i);
+
+ if (x <= width && x > 0 && y <= height && y > 0) {
+ let position = `\x1B[${y};${x}H`; // Move cursor to y,x (CSI y;x H)
+ response += `${position}${renderer(red, blue, green)} `;
+ }
+ }
+ }
+
+ return response;
+};
+
+module.exports = Circle;