1 parent ad74722 commit ad8ce08Copy full SHA for ad8ce08
1 file changed
01 - JavaScript Drum Kit/main.js
@@ -1,7 +1,6 @@
1
const keys = document.querySelectorAll('.keys');
2
3
-keys.forEach(key => {
4
-});
+keys.forEach(key => { key.addEventListener('transitionend', removeTransition)});
5
6
this.addEventListener('keydown', playSound);
7
@@ -13,5 +12,12 @@ function playSound(e) {
13
12
if (keys) {
14
const play = new Audio(audio.src);
15
play.play();
+ keys.classList.add('playing')
16
+ }
17
+}
18
+
19
+function removeTransition (e) {
20
+ if(e.propertyName === 'transform'){
21
+ e.target.className = 'key';
22
}
23
0 commit comments