100-project-100-days-website/100_projects/4-clock-ui-design/app.js
2023-02-25 18:19:46 +03:00
Ask

15 lines
439 B
JavaScript

{b30cd2995b31fe4917261e7a51c3223f1c3fef95 true 439 app.js 0xc0030c51f0}

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)`;
});