-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (23 loc) · 905 Bytes
/
script.js
File metadata and controls
27 lines (23 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
let hour = document.getElementById("hour");
let minute = document.getElementById("minute");
let second = document.getElementById("second");
let cDate = document.getElementById("cDate");
let fMonth = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
const tick = new Audio("tick.mp3");
setInterval(()=>{
d = new Date();
htime = d.getHours();
mtime = d.getMinutes();
stime = d.getSeconds();
date = d.getDate();
month = d.getMonth();
year = d.getFullYear();
hrotation = 30*htime + mtime/2;
mrotation = 6*mtime;
srotation = 6*stime;
hour.style.transform = `rotate(${hrotation}deg)`;
minute.style.transform = `rotate(${mrotation}deg)`;
second.style.transform = `rotate(${srotation}deg)`;
tick.play();
cDate.innerHTML = `<p id="text"> ${date} ${fMonth[month]} ${year} <\p>`;
}, 1000);