Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dotime(){
  2.    
  3.     $("body").css({"transition": "all 0.8s", "-webkit-transition": "all 0.8s"});
  4.    
  5.     var d = new Date();
  6.     var hours = d.getHours();
  7.     var mins = d.getMinutes();
  8.     var secs = d.getSeconds();
  9.  
  10.     if (hours < 10){hours = "0" + hours};
  11.     if (mins < 10){mins = "0" + mins};
  12.     if (secs < 10){secs = "0" + secs};
  13.    
  14.    
  15.     hours.toString();
  16.     mins.toString();
  17.     secs.toString();
  18.  
  19.     var R = Math.round(hours*255/24);
  20.     var G = Math.round(mins*255/60);
  21.     var B = Math.round(secs*255/60);
  22.    
  23.     var hex = "#" + R.toString(16) + G.toString(16) + B.toString(16);
  24.    
  25.     $("#t").html(hours +" : "+ mins +" : "+ secs);
  26.     $("#h").html(hex);
  27.    
  28.     document.body.style.background = hex;
  29.    
  30.     setTimeout(function(){ dotime();}, 1000);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement