Skip to content

Commit

Permalink
update clock
Browse files Browse the repository at this point in the history
  • Loading branch information
munusshih committed Apr 12, 2024
1 parent bc4588c commit 4388226
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions css/clock.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
transform-origin: 2px 0%;
border-radius: 50%;
z-index: 10;
transition: all 0.5s;
}

.minute-hand {
Expand All @@ -80,6 +81,7 @@
transform-origin: 2px 0%;
border-radius: 50%;
z-index: 11;
transition: all 0.5s;
}

.second-hand {
Expand All @@ -90,6 +92,7 @@
transform-origin: 1px 0%;
border-radius: 50%;
z-index: 12;
transition: all 1s;
}

.center {
Expand Down
6 changes: 3 additions & 3 deletions js/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ function updateClock() {
const minuteHand = document.querySelector('.minute-hand');
const secondHand = document.querySelector('.second-hand');

const hourDegrees = (hours % 12) * 30 + minutes / 2;
const minuteDegrees = minutes * 6 + seconds / 10;
const secondDegrees = seconds * 6;
const hourDegrees = (hours % 12) * 30 + minutes / 2 + 180;
const minuteDegrees = minutes * 6 + seconds / 10 + 180;
const secondDegrees = seconds * 6 + 180;

hourHand.style.transform = `rotate(${hourDegrees}deg)`;
minuteHand.style.transform = `rotate(${minuteDegrees}deg)`;
Expand Down

0 comments on commit 4388226

Please sign in to comment.