Advertisement
pahapoika91

Rainbow background

Dec 23rd, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <script>
  2. // Author: pahapoika91
  3. // Name: Rainbow Background
  4. // Description: The background changes colors like a rainbow, so kawaii!
  5.  
  6. var tick = 0;
  7. var rate = 0.1;
  8. window.onload=function(){
  9. setInterval(function(){
  10. tick=tick + rate;
  11. var red = Math.sin(tick) * 127 + 128;
  12. var green = Math.sin(tick + 90) * 127 + 128;
  13. var blue = Math.sin(tick + 270) * 127 + 128;
  14. red=parseInt(red);
  15. green=parseInt(green);
  16. blue=parseInt(blue);
  17. document.body.style.backgroundColor="rgb("+red+","+green+","+blue+")";
  18. },50);
  19. };
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement