Skip to content

Instantly share code, notes, and snippets.

@rlemon
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlemon/608181d303a12a2fb114 to your computer and use it in GitHub Desktop.
Save rlemon/608181d303a12a2fb114 to your computer and use it in GitHub Desktop.
(function() {
"use strict";
setTimeout(glitch, Math.random() * 3e5);
function col() {
return '#' + (Math.random() * 100).toString(16).slice(-3)
}
function glitch() {
var n = Math.floor(Math.random() * 4 + 4);
(function spazz() {
[].forEach.call(document.all, function(el) {
el.style.color = col();
el.style.backgroundColor = col();
});
if (!--n) {
return finish();
}
setTimeout(spazz, 3);
}());
}
function finish() {
[].forEach.call(document.all, function(el) {
el.style.color = '';
el.style.backgroundColor = '';
});
setTimeout(glitch, Math.random() * 6e5);
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment