-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (26 loc) · 883 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function main (){
var fulldate = new Date();
var hours = fulldate.getHours();
var minutes = fulldate.getMinutes();
var seconds = fulldate.getSeconds();
var milliseconds = fulldate.getMilliseconds();
if (hours< 10)
hours = "0" + hours;
if (minutes < 10)
minutes = "0" + minutes;
if (seconds < 10)
seconds = "0" + seconds;
document.getElementById("hour").innerHTML= hours;
document.getElementById("minute").innerHTML= minutes;
document.getElementById("second").innerHTML= seconds;
animateClock(document.getElementById("second"));
if(seconds == 00) animateClock(document.getElementById("minute"));
if(minutes = 00 && seconds == 00) animateClock(document.getElementById("hour"));
}
setInterval(main,1000);
function animateClock(span){
span.className = "turn";
setTimeout(function(){
span.className = "";
},300)
}