-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
25 lines (21 loc) · 786 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
const frame = document.querySelector(".clock-frame");
const innerFace = document.querySelector(".clock-innerface");
const pointHour = document.querySelector(".pointer-box__h");
const pointMin = document.querySelector(".pointer-box__m");
const pointSec = document.querySelector(".pointer-box__s");
/*
const hourDeg = ;
*/
function rotatePointer() {
const date = Date.now();
const hour = (date / (1000 * 60 * 60)) % 24 - 3;
const min = (date / (1000 * 60)) % 60;
const sec = (date / 1000) % 60;
const hourDeg = hour * 30;
const minDeg = min * 6;
const secDeg = sec * 6;
pointHour.style.transform = `rotate(${hourDeg}deg)`;
pointMin.style.transform = `rotate(${minDeg}deg)`;
pointSec.style.transform = `rotate(${secDeg}deg)`;
}
setInterval(rotatePointer, 0.00001);