Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function dotime(){
- $("body").css({"transition": "all 0.8s", "-webkit-transition": "all 0.8s"});
- var d = new Date();
- var hours = d.getHours();
- var mins = d.getMinutes();
- var secs = d.getSeconds();
- if (hours < 10){hours = "0" + hours};
- if (mins < 10){mins = "0" + mins};
- if (secs < 10){secs = "0" + secs};
- hours.toString();
- mins.toString();
- secs.toString();
- var R = Math.round(hours*255/24);
- var G = Math.round(mins*255/60);
- var B = Math.round(secs*255/60);
- var hex = "#" + R.toString(16) + G.toString(16) + B.toString(16);
- $("#t").html(hours +" : "+ mins +" : "+ secs);
- $("#h").html(hex);
- document.body.style.background = hex;
- setTimeout(function(){ dotime();}, 1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement