From 4fc2d294e7514565daccbffee214942d022e9523 Mon Sep 17 00:00:00 2001 From: Stanley Nguyen Date: Sun, 18 Dec 2016 11:09:01 +0800 Subject: [PATCH 1/2] minute and hour hand gradual update --- 02 - JS + CSS Clock/index-FINISHED.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02 - JS + CSS Clock/index-FINISHED.html b/02 - JS + CSS Clock/index-FINISHED.html index db653a5340..8e721313d6 100644 --- a/02 - JS + CSS Clock/index-FINISHED.html +++ b/02 - JS + CSS Clock/index-FINISHED.html @@ -81,11 +81,11 @@ secondHand.style.transform = `rotate(${secondsDegrees}deg)`; const mins = now.getMinutes(); - const minsDegrees = ((mins / 60) * 360) + 90; + const minsDegrees = ((mins / 60) * 360) + 90 + (secondsDegrees - 90) / 60; minsHand.style.transform = `rotate(${minsDegrees}deg)`; const hour = now.getHours(); - const hourDegrees = ((hour / 12) * 360) + 90; + const hourDegrees = ((hour / 12) * 360) + 90 + 12 * (minsDegrees - 90) / 60; hourHand.style.transform = `rotate(${hourDegrees}deg)`; } From 769f166379a59e5a0cb598d8bfdae9816970e29a Mon Sep 17 00:00:00 2001 From: Stanley Nguyen Date: Sun, 18 Dec 2016 11:17:34 +0800 Subject: [PATCH 2/2] accurate calculation --- 02 - JS + CSS Clock/index-FINISHED.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02 - JS + CSS Clock/index-FINISHED.html b/02 - JS + CSS Clock/index-FINISHED.html index 8e721313d6..97c06f9007 100644 --- a/02 - JS + CSS Clock/index-FINISHED.html +++ b/02 - JS + CSS Clock/index-FINISHED.html @@ -85,7 +85,7 @@ minsHand.style.transform = `rotate(${minsDegrees}deg)`; const hour = now.getHours(); - const hourDegrees = ((hour / 12) * 360) + 90 + 12 * (minsDegrees - 90) / 60; + const hourDegrees = ((hour / 12) * 360) + 90 + (minsDegrees - 90) / 12; hourHand.style.transform = `rotate(${hourDegrees}deg)`; }