-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (17 loc) · 699 Bytes
/
index.js
File metadata and controls
22 lines (17 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const secondHand = document.querySelector(".second-hand")
const minHand = document.querySelector(".min-hand")
const hourHand = document.querySelector(".hour-hand")
function setDate(){
const now = new Date();
const seconds = now.getSeconds();
const secondsDegree = (seconds/60)*360;
secondHand.style.transform=`rotate(${secondsDegree}deg)`;
const minuteHand = now.getMinutes();
const minsDegree = (minuteHand/60)*360;
minHand.style.transform=`rotate(${minsDegree}deg)`;
const hours = now.getHours();
const hoursDegree = (hours/60)*360;
hourHand.style.transform=`rotate(${hoursDegree}deg)`
console.log(secondsDegree);
};
setInterval(setDate, 1000);