From 15235873a9b8ca44c0d68313f61fc56de141b163 Mon Sep 17 00:00:00 2001 From: dbobbitt Date: Thu, 12 Jan 2017 19:50:11 -0500 Subject: [PATCH 1/3] Implement drum kit (day 1) --- 01 - JavaScript Drum Kit/index-START.html | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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); + + From 5f4c42b6a37893cb500010b352bd98209ee37fc0 Mon Sep 17 00:00:00 2001 From: dbobbitt Date: Fri, 13 Jan 2017 17:59:58 -0500 Subject: [PATCH 2/3] Implement JS + CSS Clock with graceful beginning animation --- 02 - JS + CSS Clock/index-START.html | 45 ++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) 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; } From 2227425156832fa7a7eb3490d38ed600b94d11da Mon Sep 17 00:00:00 2001 From: dbobbitt Date: Sun, 15 Jan 2017 17:47:46 -0500 Subject: [PATCH 3/3] Play with CSS variables --- 03 - CSS Variables/index-START.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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