shapescreensaver
Advanced tools
Comparing version 1.0.0 to 1.1.0
35
index.js
#!/usr/bin/env node | ||
let isRunning = true; | ||
function s(d) { | ||
@@ -29,2 +32,3 @@ let v = Date.now() | ||
function thread() { | ||
if (!isRunning) return; | ||
for (x = (-i * 2); x < (i * 2); x++) { | ||
@@ -40,4 +44,2 @@ for (y = (-i); y < i; y++) { | ||
} | ||
i++; | ||
@@ -53,20 +55,27 @@ if (i > rad) return; | ||
} | ||
index = 0 | ||
function pickNew() { | ||
//index++; | ||
if (index > 10) return; | ||
for (i = 0; i < 2; i++) { | ||
let x = Math.floor(Math.random() * process.stdout.columns) | ||
let y = Math.floor(Math.random() * process.stdout.rows) | ||
drawSqu(x, y, Math.floor(Math.random()*5)+5, `\x1b[38;2;${rc()};${rc()};${rc()}m█\x1b[0m`, 50) | ||
drawSqu(x, y, Math.floor(Math.random() * 5) + 5, `\x1b[38;2;${rc()};${rc()};${rc()}m█\x1b[0m`, 50) | ||
} | ||
setTimeout(() => { | ||
pickNew() | ||
}, 300) | ||
} | ||
pickNew(); | ||
let itv = setInterval(pickNew, 300) | ||
require("process").on("SIGINT", (a) => { | ||
clearInterval(itv) | ||
isRunning = false; | ||
h = process.stdout.rows; | ||
for (x = 0; x < w; x++) { | ||
for (y = 0; y < h; y++) { | ||
process.stdout.cursorTo(x, y) | ||
process.stdout.write(" ") | ||
for (i = 0; i < 100000; i++) {} | ||
} | ||
} | ||
//process.stdout.cursorTo(0,0) | ||
process.stdout.cursorTo(0, 0) | ||
console.log(";)") | ||
s(1000) | ||
console.clear(); | ||
}) |
{ | ||
"name": "shapescreensaver", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Simple screensaver", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2247
70