forked from codemistic/Web-Development
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
19 lines (14 loc) · 657 Bytes
/
index.js
File metadata and controls
19 lines (14 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
let secondsHand = document.querySelector(".seconds-hand");
let minutesHand = document.querySelector(".minutes-hand");
let hoursHand = document.querySelector(".hours-hand");
function getTime(){
let now = new Date();
let seconds = now.getSeconds()
let minutes = now.getMinutes()
let hours = now.getHours()
let timeInterval = 6;
secondsHand.style.transform = 'rotate(' + (seconds * timeInterval) + 'deg)';
minutesHand.style.transform = 'rotate(' + (minutes* timeInterval + seconds/10) + 'deg)';
hoursHand.style.transform = 'rotate(' + (hours*30 + minutes/2) + 'deg)';
}
setInterval(getTime, 100)