100-project-100-days-website/100_projects/4-clock-ui-design/app.js

15 lines
439 B
JavaScript
Raw Normal View History

2023-02-25 18:19:46 +03:00
const deg = 6;
const h = document.querySelector('#h');
const m = document.querySelector('#m');
const s = document.querySelector('#s');
setInterval(() => {
let day = new Date();
let hh = day.getHours() * 30;
let mm = day.getMinutes() * deg;
let ss = day.getSeconds() * deg;
h.style.transform = `rotateZ(${hh+(mm/12)}deg)`;
m.style.transform = `rotateZ(${mm}deg)`;
s.style.transform = `rotateZ(${ss}deg)`;
});