diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..d333e052a2 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,25 @@ diff --git a/02 - JS + CSS Clock/clock.js b/02 - JS + CSS Clock/clock.js new file mode 100644 index 0000000000..57557a4b8b --- /dev/null +++ b/02 - JS + CSS Clock/clock.js @@ -0,0 +1,15 @@ +setInterval(() => { + const current = new Date() + + const hour = current.getHours() + const minutes = current.getMinutes() + const seconds = current.getSeconds() + + const hourHand = document.querySelector('.hour-hand') + const minuteHand = document.querySelector('.min-hand') + const secondHand = document.querySelector('.second-hand') + + hourHand.style.transform = 'rotate(' + ((hour / 12) * 360 + 90) + 'deg)' + minuteHand.style.transform = 'rotate(' + ((minutes / 60) * 360 + 90) + 'deg)' + secondHand.style.transform = 'rotate(' + ((seconds / 60) * 360 + 90) + 'deg)' +}) diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..fed9c854c5 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -6,29 +6,28 @@
- -