-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
19 lines (17 loc) · 709 Bytes
/
script.js
File metadata and controls
19 lines (17 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const HOURHAND = document.querySelector("#hour");
const MINUTEHAND = document.querySelector("#minute");
const SECONDHAND = document.querySelector("#second");
function runTheClock(){
var date = new Date();
console.log(date);
let hr = date.getHours();
let min = date.getMinutes();
let sec = date.getSeconds();
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(runTheClock,1000);