A
@@ -57,10 +57,8 @@
-
-
+
-
+
+
\ No newline at end of file
diff --git a/01 - JavaScript Drum Kit/main.js b/01 - JavaScript Drum Kit/main.js
new file mode 100644
index 0000000000..012318962f
--- /dev/null
+++ b/01 - JavaScript Drum Kit/main.js
@@ -0,0 +1,22 @@
+function playSound(e) {
+ const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`);
+ const $key = document.querySelector(`div[data-key="${e.keyCode}"]`);
+ if (audio !== null) {
+ audio.currentTime = 0;
+ audio.play();
+ }
+ if ($key !== null) {
+ $key.classList.add("playing");
+ }
+}
+
+function stopTransition(e) {
+ if (e.propertyName === "transform") {
+ e.target.classList.remove("playing");
+ }
+}
+
+window.addEventListener("keydown", playSound);
+
+const $keys = document.querySelectorAll("div[data-key]");
+$keys.forEach($key => $key.addEventListener("transitionend", stopTransition));
\ No newline at end of file
diff --git a/01 - JavaScript Drum Kit/style.css b/01 - JavaScript Drum Kit/style.css
index a69d6b635d..73d5daec9a 100644
--- a/01 - JavaScript Drum Kit/style.css
+++ b/01 - JavaScript Drum Kit/style.css
@@ -1,10 +1,11 @@
html {
font-size: 10px;
- background: url(https://i.imgur.com/b9r5sEL.jpg) bottom center;
+ background: url(./images/background.jpg) bottom center;
background-size: cover;
}
-body,html {
+body,
+html {
margin: 0;
padding: 0;
font-family: sans-serif;
@@ -28,7 +29,7 @@ body,html {
width: 10rem;
text-align: center;
color: white;
- background: rgba(0,0,0,0.4);
+ background: rgba(0, 0, 0, 0.4);
text-shadow: 0 0 .5rem black;
}
@@ -48,4 +49,4 @@ kbd {
text-transform: uppercase;
letter-spacing: .1rem;
color: #ffc600;
-}
+}
\ No newline at end of file
diff --git a/02 - JS and CSS Clock/index-FINISHED.html b/02 - JS and CSS Clock/index-FINISHED.html
deleted file mode 100644
index 04d1a4e40e..0000000000
--- a/02 - JS and CSS Clock/index-FINISHED.html
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
-
-
JS + CSS Clock
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html
deleted file mode 100644
index 7a6d27d5bd..0000000000
--- a/02 - JS and CSS Clock/index-START.html
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
JS + CSS Clock
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/02 - JS and CSS Clock/index.html b/02 - JS and CSS Clock/index.html
new file mode 100644
index 0000000000..3843fad764
--- /dev/null
+++ b/02 - JS and CSS Clock/index.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
JS + CSS Clock
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/02 - JS and CSS Clock/main.js b/02 - JS and CSS Clock/main.js
new file mode 100644
index 0000000000..7fec7eae43
--- /dev/null
+++ b/02 - JS and CSS Clock/main.js
@@ -0,0 +1,20 @@
+const $secondHand = document.querySelector(".second-hand");
+const $minHand = document.querySelector(".min-hand");
+const $hourHand = document.querySelector(".hour-hand");
+
+function setDate() {
+ const now = new Date();
+ const secounds = now.getSeconds();
+ const secoundsDegree = ((secounds / 60) * 360) + 90;
+ $secondHand.style.transform = `rotate(${secoundsDegree}deg)`
+
+ const mins = now.getMinutes();
+ const minssDegree = ((mins / 60) * 360) + 90;
+ $minHand.style.transform = `rotate(${minssDegree}deg)`
+
+ const hours = now.getHours();
+ const hoursDegree = ((hours / 60) * 360) + 90;
+ $hourHand.style.transform = `rotate(${hoursDegree}deg)`
+}
+
+setInterval(() => setDate(), 1000);
\ No newline at end of file
diff --git a/02 - JS and CSS Clock/style.css b/02 - JS and CSS Clock/style.css
new file mode 100644
index 0000000000..897bd048fd
--- /dev/null
+++ b/02 - JS and CSS Clock/style.css
@@ -0,0 +1,51 @@
+html {
+ background: #018DED url(https://unsplash.it/1500/1000?image=881&blur=5);
+ background-size: cover;
+ font-family: 'helvetica neue';
+ text-align: center;
+ font-size: 10px;
+}
+
+body {
+ margin: 0;
+ font-size: 2rem;
+ display: flex;
+ flex: 1;
+ min-height: 100vh;
+ align-items: center;
+}
+
+.clock {
+ width: 30rem;
+ height: 30rem;
+ border: 20px solid white;
+ border-radius: 50%;
+ margin: 50px auto;
+ position: relative;
+ padding: 2rem;
+ box-shadow:
+ 0 0 0 4px rgba(0, 0, 0, 0.1),
+ inset 0 0 0 3px #EFEFEF,
+ inset 0 0 10px black,
+ 0 0 10px rgba(0, 0, 0, 0.2);
+}
+
+.clock-face {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ transform: translateY(-3px);
+ /* account for the height of the clock hands */
+}
+
+.hand {
+ width: 50%;
+ height: 6px;
+ background: black;
+ position: absolute;
+ top: 50%;
+ transform: rotate(90deg);
+ transform-origin: 100%;
+ transition: all 0.05s;
+ transition-timing-function: cubic-bezier(0.55, -1.14, 0.74, 2.87);
+}
\ No newline at end of file
diff --git a/03 - CSS Variables/index-FINISHED.html b/03 - CSS Variables/index-FINISHED.html
deleted file mode 100644
index 2f0d1464ff..0000000000
--- a/03 - CSS Variables/index-FINISHED.html
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
Scoped CSS Variables and JS
-
-
-
Update CSS Variables with JS
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index.html
similarity index 63%
rename from 03 - CSS Variables/index-START.html
rename to 03 - CSS Variables/index.html
index 6b9b539c09..aa0c50d3b9 100644
--- a/03 - CSS Variables/index-START.html
+++ b/03 - CSS Variables/index.html
@@ -1,9 +1,12 @@
+
Scoped CSS Variables and JS
+
+
Update CSS Variables with JS
@@ -20,32 +23,7 @@
Update CSS Variables with JS

-
-
-
-
+
-
+
+