Created
September 21, 2016 08:02
-
-
Save silviorelli/9bca67611a3d05facbea8168c92b7d94 to your computer and use it in GitHub Desktop.
Epilessia portami via
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
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