diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..5c2d5a959f 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,8 +59,28 @@ + function removeTransition(e) { + if (e.propertyName === 'transform') { + e.target.classList.remove('playing'); + } + } + + function playSound(e) { + const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`); + const key = document.querySelector(`div[data-key="${e.keyCode}"]`); + + if (audio && key) { + key.classList.add('playing'); + audio.currentTime = 0; + audio.play(); + } + } + const keys = Array.from(document.querySelectorAll('.key')); + keys.forEach(key => key.addEventListener('transitionend', removeTransition)); + window.addEventListener('keydown', playSound); + + diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..0448d3d720 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -9,9 +9,9 @@
-
-
-
+
+
+
@@ -61,12 +61,51 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.05s; + transition-timing-function: cubic-bezier(0, 2.76, 0.9, 0.01); + } + + .slow { + transition: all 0.8s; + } + + .second-hand { + background: red; } diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..bd30929101 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -22,6 +22,22 @@

Update CSS Variables with JS