Skip to content

Instantly share code, notes, and snippets.

@mimshwright
Created April 10, 2014 23:23
Show Gist options
  • Save mimshwright/10431549 to your computer and use it in GitHub Desktop.
Save mimshwright/10431549 to your computer and use it in GitHub Desktop.
Show an animated ripple effect in your console.
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