-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp2.js
34 lines (25 loc) · 998 Bytes
/
app2.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
var myVar;
function myFunction() {
myVar = setTimeout(showPage, 1000);
}
function showPage() {
document.getElementById("loader").style.display = "none";
document.getElementById("myDiv").style.display = "block";
}
const HOURHAND = document.querySelector("#hour");
const MINUTEHAND = document.querySelector("#minute");
const SECONDHAND = document.querySelector("#second");
function run_the_clock() {
var date = new Date();
let hr = date.getHours();
let min = date.getMinutes();
let sec = date.getSeconds();
console.log("Hour: " + hr + " Minute: " + min + " Second: " + sec);
let hrPosition = hr * 360 / 12 + ((min * 360 / 60) / 12);
let minPosition = (min * 360 / 60) + (sec * 360 / 60) / 60;
let secPosition = sec * 360 / 60;
HOURHAND.style.transform = "rotate(" + hrPosition + "deg)";
MINUTEHAND.style.transform = "rotate(" + minPosition + "deg)";
SECONDHAND.style.transform = "rotate(" + secPosition + "deg)";
}
var interval = setInterval(run_the_clock, 1000);