Skip to content

Instantly share code, notes, and snippets.

@janwillem2020
Forked from albertodelax/index.html
Created September 14, 2020 09:18
Show Gist options
  • Save janwillem2020/6931c7ae8cae323fb565cb88f83f01fd to your computer and use it in GitHub Desktop.
Save janwillem2020/6931c7ae8cae323fb565cb88f83f01fd to your computer and use it in GitHub Desktop.
Rainbow Background Animation
<!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>
@ddsifghsudfyvghsdfv
Copy link

how do i use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment