-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
18 lines (14 loc) · 657 Bytes
/
Copy pathapp.js
File metadata and controls
18 lines (14 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const secondsHand = document.getElementById('seconds-hand')
const minutesHand = document.getElementById('minutes-hand')
const hoursHand = document.getElementById('hours-hand')
function getTime() {
const now = new Date()
const seconds = now.getSeconds()
const minutes = now.getMinutes()
const hours = now.getHours()
const 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)'
}
getTime(setInterval(getTime, 1000))