Created
August 5, 2015 17:09
-
-
Save albertodelax/856e67e9ba5905c051db to your computer and use it in GitHub Desktop.
Rainbow Background Animation
This file contains hidden or 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<style type="text/css"> | |
body { | |
background-color: red; | |
transition: background-color 7s; | |
} | |
</style> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]; | |
var i = 1; | |
window.setInterval(function(){ | |
document.body.style.backgroundColor = colors[i]; | |
i++; | |
if (i === colors.length){ | |
i=0; | |
} | |
}, 5000); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what