From d1aa35a806a8a2f697eb148f3e6daa36cc8a6d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaume=20Montan=C3=A9?= <70690658+jaumemy@users.noreply.github.com> Date: Thu, 14 Jan 2021 01:15:38 +0100 Subject: [PATCH] Fixing the hands As I see it, the function scale shout range between 0 and 12 and between 0 and 60. Comparing it to real clocks or just comparing degrees to hours the difference is clearly noticeable, especially the hours, since its divided in only 12 parts. Let me know what you think..:) Thanks for this great course btw, I'm learning a lot! --- theme-clock/script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/theme-clock/script.js b/theme-clock/script.js index 20efd6c..5f1126d 100644 --- a/theme-clock/script.js +++ b/theme-clock/script.js @@ -30,9 +30,9 @@ function setTime() { const seconds = time.getSeconds() const ampm = hours >= 12 ? 'PM' : 'AM' - hourEl.style.transform = `translate(-50%, -100%) rotate(${scale(hoursForClock, 0, 11, 0, 360)}deg)` - minuteEl.style.transform = `translate(-50%, -100%) rotate(${scale(minutes, 0, 59, 0, 360)}deg)` - secondEl.style.transform = `translate(-50%, -100%) rotate(${scale(seconds, 0, 59, 0, 360)}deg)` + hourEl.style.transform = `translate(-50%, -100%) rotate(${scale(hoursForClock, 0, 12, 0, 360)}deg)` + minuteEl.style.transform = `translate(-50%, -100%) rotate(${scale(minutes, 0, 60, 0, 360)}deg)` + secondEl.style.transform = `translate(-50%, -100%) rotate(${scale(seconds, 0, 60, 0, 360)}deg)` timeEl.innerHTML = `${hoursForClock}:${minutes < 10 ? `0${minutes}` : minutes} ${ampm}` dateEl.innerHTML = `${days[day]}, ${months[month]} ${date}`