Skip to content

Instantly share code, notes, and snippets.

@silviorelli
Created September 21, 2016 08:02
Show Gist options
  • Save silviorelli/9bca67611a3d05facbea8168c92b7d94 to your computer and use it in GitHub Desktop.
Save silviorelli/9bca67611a3d05facbea8168c92b7d94 to your computer and use it in GitHub Desktop.
Epilessia portami via
function party_background_color() {
$("html, body").css("background-color", getRandomColor());
var all = document.getElementsByTagName("*");
for (var i = 0, max = all.length; i < max; i++) {
$(all[i]).css("color", getRandomColor());
$(all[i]).css("background-color", getRandomColor());
}
}
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
function distortRandomElement() {
var all = document.getElementsByTagName("*");
var randomI = Math.floor((Math.random() * all.length) + 1);
for (var i = 0, max = all.length; i < max; i++) {
if (i === randomI) {
$(all[i]).css("color", getRandomColor());
$(all[i]).css("background-color", getRandomColor());
$(all[i]).css("font-size", Math.floor((Math.random() * 50) + 1));
$(all[i]).css("min-height", Math.floor((Math.random() * 100) + 1));
$(all[i]).css("min-width", Math.floor((Math.random() * 100) + 1));
break;
}
}
}
party_background_color();
distortRandomElement();
setInterval('party_background_color();', 200);
setInterval('distortRandomElement();', 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment