Skip to content

Commit 144f205

Browse files
Matt JaredMatt Jared
authored andcommitted
adding day 2
1 parent 5c39dab commit 144f205

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

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

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,32 @@
6464
transform-origin: 100%;
6565
transform: rotate(90deg);
6666
transition: all 0.05s;
67-
transition-timing-function: ease-in-out;
67+
transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1);
6868
}
69-
7069
</style>
7170

7271
<script>
73-
function setDate() {
74-
const now = new Date();
75-
const seconds = now.getSeconds();
76-
const secondsDegrees = ((seconds / 60) * 360);
7772
const secondHand = document.querySelector('.second-hand');
73+
const minuteHand = document.querySelector('.min-hand');
74+
const hourHand = document.querySelector('.hour-hand');
75+
76+
function setDate() {
77+
const now = new Date();
78+
const seconds = now.getSeconds();
79+
const minutes = now.getMinutes();
80+
const hours = now.getHours();
7881

79-
console.log(seconds);
80-
}
82+
const secondsDegrees = ((seconds / 60) * 360) + 90;
83+
const minutesDegrees = ((minutes / 60) * 360) + 90;
84+
const hoursDegrees = ((hours / 12) * 360) + 90;
85+
86+
secondHand.style.transform = `rotate(${secondsDegrees}deg)`;
87+
minuteHand.style.transform = `rotate(${minutesDegrees}deg)`;
88+
hourHand.style.transform = `rotate(${hoursDegrees}deg)`;
89+
}
90+
setInterval(setDate, 1000);
8191

82-
setInterval(setDate, 1000);
92+
setDate();
8393

8494
</script>
8595
</body>

0 commit comments

Comments
 (0)