Created
April 10, 2014 23:23
-
-
Save mimshwright/10431549 to your computer and use it in GitHub Desktop.
Show an animated ripple effect in your console.
This file contains hidden or 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 timer; | |
var cycle = " ░▒▓█▓▒░"; | |
function showRainbow() { | |
var offset = 0; | |
var css = "font-family:'Arial Black'; font-size: 32px; color: red;"; | |
clearInterval(timer); | |
timer = setInterval( | |
function () { | |
console.clear(); | |
// console.log(timer); | |
offset++; | |
var output = ""; | |
var l = 45; | |
for (var i = 0; i < l; i++) { | |
if (i % (cycle.length+1) == 0) { | |
output += "\n"; | |
} | |
var char = (offset + i) % cycle.length; | |
output += cycle.substr(char, 1); | |
} | |
console.log("%c" + output , css); | |
} | |
, 60); | |
} | |
showRainbow(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment