Add js code
This commit is contained in:
parent
28a8525181
commit
d34aaec76e
1 changed files with 13 additions and 0 deletions
13
main.js
13
main.js
|
@ -0,0 +1,13 @@
|
||||||
|
setInterval(setClock, 1000);
|
||||||
|
|
||||||
|
function setClock() {
|
||||||
|
const currentDate = new Date();
|
||||||
|
|
||||||
|
const secRatio = currentDate.getSeconds() / 60;
|
||||||
|
const minRatio = (secRatio + currentDate.getMinutes()) / 60;
|
||||||
|
const horRatio = (minRatio + currentDate.getHours()) / 12;
|
||||||
|
|
||||||
|
document.getElementById('sek').style.setProperty('--rotation', secRatio * 360);
|
||||||
|
document.getElementById('min').style.setProperty('--rotation', minRatio * 360);
|
||||||
|
document.getElementById('hrs').style.setProperty('--rotation', horRatio * 360);
|
||||||
|
}
|
Loading…
Reference in a new issue