Skip to content

Commit 2c480df

Browse files
committed
2nd done.
1 parent 4f57364 commit 2c480df

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

02 - JS + CSS Clock/index-START.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,31 @@
6161
background:black;
6262
position: absolute;
6363
top:50%;
64+
transform: rotate(90deg);
65+
transition-timing-function: ease-in-out;
66+
transform-origin: 100%;
67+
transition-duration: 0.1s;
6468
}
6569

6670
</style>
6771

6872
<script>
73+
const secondHand = document.querySelector(`.second-hand`);
74+
const minuteHand = document.querySelector(`.min-hand`);
75+
const hourHand = document.querySelector(`.hour-hand`);
76+
function time() {
77+
var date = new Date();
78+
var seconds = 90 + date.getSeconds()*6
79+
secondHand.style.transform = `rotate(${seconds}deg)`;
6980

81+
var minutes = 90 + date.getMinutes()*6
82+
minuteHand.style.transform = `rotate(${minutes}deg)`;
83+
84+
var hours = 90 + date.getHours()*30
85+
hourHand.style.transform = `rotate(${hours}deg)`;
86+
}
87+
88+
setInterval(time, 1000);
7089

7190
</script>
7291
</body>

0 commit comments

Comments
 (0)