Created
March 28, 2013 20:00
-
-
Save wlaurance/5266319 to your computer and use it in GitHub Desktop.
bouncing marks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mark = process.env.MARK || "-", | |
window = process.env.WINDOW || 100, | |
start = process.env.START || 0, | |
down = true; | |
var canvas = ""; | |
for(var m = 0; m < window; m++){ | |
canvas += " "; | |
} | |
setInterval(function(){ | |
if (down){ | |
var space = ""; | |
for(var j = 0; j < start; j++){ | |
space += " "; | |
} | |
console.log(space + mark); | |
start++; | |
if (start == window) down = false; | |
} else { | |
var space = ""; | |
for(var j = window; j > start; j--){ | |
space += " "; | |
} | |
console.log(canvas.substring(0, window - space.length) + mark); | |
start--; | |
if (start === 0) down = true; | |
} | |
}, process.env.TIMEOUT || 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment