Skip to content

Instantly share code, notes, and snippets.

@rgaspary
Created June 28, 2013 14:21
Show Gist options
  • Save rgaspary/5885034 to your computer and use it in GitHub Desktop.
Save rgaspary/5885034 to your computer and use it in GitHub Desktop.
Random Color changing Div
var count = 8;
var colors = ["#FFA722","#22D3FF","#0AB418","#854BFF","#FF2663","#FF0D4C","#FFA722","#FF0D4C"];
for (var i = 0; i < count; i++){
var rand = Math.floor(Math.random()*colors.length);
$('#skill' + i).css("background-color", colors[rand]);
}
window.setInterval( function () {
var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
$('body').animate( { backgroundColor: hue }, 1000);
}, 5000);
window.setInterval( function () {
spectrum();
}, 5000);
function spectrum(){
var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
$('body').animate( { backgroundColor: hue }, 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment