-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
22 lines (17 loc) · 689 Bytes
/
script.js
File metadata and controls
22 lines (17 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
setInterval(setclock, 1000)
const hourhand = document.querySelector("#hour-hand")
const minutshand = document.querySelector("#minuts-hand")
const secondhand = document.querySelector("#second-hand")
function setclock() {
const currentDate = new Date();
const secondratio = currentDate.getSeconds() / 60
const minutesratio = (secondratio + currentDate.getMinutes()) / 60
const hoursratio = (minutesratio + currentDate.getHours()) / 12
}
setRotation(secondhand, secondratio)
setRotation(minutshand, minutesratio)
setRotation(hourhand, hoursratio)
function setRotation(element, rotationRatio) {
element.style.setProperty('--rotation', rotationRatio * 360)
}
setclock()