|
18 | 18 |
|
19 | 19 | <style> |
20 | 20 | html { |
21 | | - background:#018DED url(http://unsplash.it/1500/1000?image=881&blur=50); |
| 21 | + background:#333 url(http://unsplash.it/1500/1000?image=1035); |
22 | 22 | background-size:cover; |
23 | 23 | font-family:'helvetica neue'; |
24 | 24 | text-align: center; |
|
66 | 66 | transition: all 0.05s; |
67 | 67 | transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); |
68 | 68 | } |
69 | | -</style> |
| 69 | + </style> |
70 | 70 |
|
71 | | -<script> |
72 | | - const secondHand = document.querySelector('.second-hand'); |
73 | | - const minsHand = document.querySelector('.min-hand'); |
74 | | - const hourHand = document.querySelector('.hour-hand'); |
| 71 | + <script> |
| 72 | + const secondHand = document.querySelector('.second-hand'); |
| 73 | + const minHand = document.querySelector('.min-hand'); |
| 74 | + const hourHand = document.querySelector('.hour-hand'); |
75 | 75 |
|
76 | | - function setDate() { |
77 | | - const now = new Date(); |
| 76 | + function setDate() { |
| 77 | + const now = new Date(); |
78 | 78 |
|
79 | | - const seconds = now.getSeconds(); |
80 | | - const secondsDegrees = ((seconds / 60) * 360) + 90; |
81 | | - secondHand.style.transform = `rotate(${secondsDegrees}deg)`; |
| 79 | + const seconds = now.getSeconds(); |
| 80 | + const secondsDegree = (seconds*360/60) + 90; |
| 81 | + secondHand.style.transform = `rotate(${secondsDegree}deg)`; |
82 | 82 |
|
83 | | - const mins = now.getMinutes(); |
84 | | - const minsDegrees = ((mins / 60) * 360) + 90; |
85 | | - minsHand.style.transform = `rotate(${minsDegrees}deg)`; |
| 83 | + const min = now.getMinutes(); |
| 84 | + const minDegree = (min*360/60) + 90; |
| 85 | + minHand.style.transform = `rotate(${minDegree}deg)`; |
86 | 86 |
|
87 | | - const hour = now.getHours(); |
88 | | - const hourDegrees = ((hour / 12) * 360) + 90; |
89 | | - hourHand.style.transform = `rotate(${hourDegrees}deg)`; |
90 | | - } |
| 87 | + const hour = now.getHours(); |
| 88 | + const hourDegree = (min*360/12) + 90; |
| 89 | + hourHand.style.transform = `rotate(${hourDegree}deg)`; |
| 90 | + } |
91 | 91 |
|
92 | | - setInterval(setDate, 1000); |
| 92 | + setInterval(setDate, 1000); |
93 | 93 |
|
94 | | - setDate(); |
| 94 | + setDate(); |
95 | 95 |
|
96 | | -</script> |
| 96 | + </script> |
97 | 97 | </body> |
98 | 98 | </html> |
0 commit comments