From 31977db4df322abb3d824c7689be30bb47151ef4 Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Sun, 11 Dec 2016 17:03:43 -0500 Subject: [PATCH 1/8] finishes 01 --- .../{ => index-files}/index-FINISHED.html | 0 .../index.html} | 19 ++- 01 - JavaScript Drum Kit/index.html | 148 +++++++++--------- 3 files changed, 91 insertions(+), 76 deletions(-) rename 01 - JavaScript Drum Kit/{ => index-files}/index-FINISHED.html (100%) rename 01 - JavaScript Drum Kit/{index-START.html => index-files/index.html} (70%) diff --git a/01 - JavaScript Drum Kit/index-FINISHED.html b/01 - JavaScript Drum Kit/index-files/index-FINISHED.html similarity index 100% rename from 01 - JavaScript Drum Kit/index-FINISHED.html rename to 01 - JavaScript Drum Kit/index-files/index-FINISHED.html diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-files/index.html similarity index 70% rename from 01 - JavaScript Drum Kit/index-START.html rename to 01 - JavaScript Drum Kit/index-files/index.html index 4070d32767..246639f990 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-files/index.html @@ -59,8 +59,25 @@ + function playSound(e) { + const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`); + const key = document.querySelector(`.key[data-key="${e.keyCode}"]`); + if (!audio) return; // stop the function from running all together + audio.currentTime = 0; // rewind to the start + audio.play(); + key.classList.add('playing'); + } + function removeTransition(e) { + if (e.propertyName !== 'transform') return; // skip it if it's not a transform + this.classList.remove('playing'); + } + + const keys = document.querySelectorAll('.key'); + keys.forEach(key => key.addEventListener('transitionend', removeTransition)); + window.addEventListener('keydown', playSound); + + diff --git a/01 - JavaScript Drum Kit/index.html b/01 - JavaScript Drum Kit/index.html index 246639f990..3cc4e44c33 100644 --- a/01 - JavaScript Drum Kit/index.html +++ b/01 - JavaScript Drum Kit/index.html @@ -1,83 +1,81 @@ - - - Codestin Search App - - - + + + Codestin Search App + + + - -
-
- A - clap -
-
- S - hihat -
-
- D - kick -
-
- F - openhat -
-
- G - boom -
-
- H - ride -
-
- J - snare +
+
+ A + clap +
+
+ S + hihat +
+
+ D + kick +
+
+ F + openhat +
+
+ G + boom +
+
+ H + ride +
+
+ J + snare +
+
+ K + tom +
+
+ L + tink +
-
- K - tom -
-
- L - tink -
-
- - - - - - - - - - - - + + From efcdf2f8c5f1bf136f99a78c4d8975a956ef9aa9 Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Wed, 14 Dec 2016 14:19:30 -0500 Subject: [PATCH 2/8] setup --- 02 - JS + CSS Clock/index.html | 33 +++---------------- .../{ => index}/index-FINISHED.html | 0 .../{index-START.html => index/index.html} | 29 ++++++++++++++-- 3 files changed, 31 insertions(+), 31 deletions(-) rename 02 - JS + CSS Clock/{ => index}/index-FINISHED.html (100%) rename 02 - JS + CSS Clock/{index-START.html => index/index.html} (59%) diff --git a/02 - JS + CSS Clock/index.html b/02 - JS + CSS Clock/index.html index 1c777557da..e6585f00d0 100644 --- a/02 - JS + CSS Clock/index.html +++ b/02 - JS + CSS Clock/index.html @@ -60,37 +60,14 @@ height:6px; background:black; position: absolute; - top:50%; transform-origin: 100%; - transform: rotate(90deg); - transition: all 0.05s; - transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); + top:50%; } - - - + diff --git a/02 - JS + CSS Clock/index-FINISHED.html b/02 - JS + CSS Clock/index/index-FINISHED.html similarity index 100% rename from 02 - JS + CSS Clock/index-FINISHED.html rename to 02 - JS + CSS Clock/index/index-FINISHED.html diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index/index.html similarity index 59% rename from 02 - JS + CSS Clock/index-START.html rename to 02 - JS + CSS Clock/index/index.html index 2712384201..1c777557da 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index/index.html @@ -61,13 +61,36 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.05s; + transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); } + - + + const mins = now.getMinutes(); + const minsDegrees = ((mins / 60) * 360) + 90; + minsHand.style.transform = `rotate(${minsDegrees}deg)`; + + const hour = now.getMinutes(); + const hourDegrees = ((mins / 12) * 360) + 90; + hourHand.style.transform = `rotate(${hourDegrees}deg)`; + } + + setInterval(setDate, 1000); + + From 4de39fa149da830e6ebd4b9c87f0599a9b270f76 Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Wed, 14 Dec 2016 14:38:31 -0500 Subject: [PATCH 3/8] finishes 02 --- 02 - JS + CSS Clock/index.html | 112 ++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 45 deletions(-) diff --git a/02 - JS + CSS Clock/index.html b/02 - JS + CSS Clock/index.html index e6585f00d0..0aa9b115df 100644 --- a/02 - JS + CSS Clock/index.html +++ b/02 - JS + CSS Clock/index.html @@ -16,57 +16,79 @@
- From 622d7e3a0a54e56dcfbe9925a63e8de1be503bdc Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Thu, 15 Dec 2016 17:20:27 -0500 Subject: [PATCH 4/8] finises with bugz --- .../{index-START.html => index.html} | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) rename 05 - Flex Panel Gallery/{index-START.html => index.html} (73%) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index.html similarity index 73% rename from 05 - Flex Panel Gallery/index-START.html rename to 05 - Flex Panel Gallery/index.html index e1d643ad5c..4a90472cf6 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index.html @@ -24,6 +24,7 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; } .panel { @@ -41,6 +42,12 @@ font-size: 20px; background-size:cover; background-position:center; + + flex: 1 0 auto; + /*justify-content: center;*/ + align-content: center; + display: flex; + flex-direction: column; } @@ -54,6 +61,26 @@ margin:0; width: 100%; transition:transform 0.5s; + flex: 1 0 auto; + justify-content: center; + align-items: center; + } + + + .panel > *:first-child { + transform: translateY(-100%); + } + + .panel > *:last-child { + transform: translateY(100%); + } + + .panel.open-active > *:first-child { + transform: translateY(0); + } + + .panel.open-active > *:last-child { + transform: translateY(0); } .panel p { @@ -68,6 +95,7 @@ .panel.open { font-size:40px; + flex: 5; } .cta { @@ -107,7 +135,25 @@ From 5b87f050626b815ed43d042828059a63c766f8cb Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Mon, 19 Dec 2016 16:02:37 -0500 Subject: [PATCH 5/8] finish 6 --- 06 - Type Ahead/index-START.html | 22 ------------- 06 - Type Ahead/index.html | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 22 deletions(-) delete mode 100644 06 - Type Ahead/index-START.html create mode 100644 06 - Type Ahead/index.html diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html deleted file mode 100644 index 1436886918..0000000000 --- a/06 - Type Ahead/index-START.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Codestin Search App - - - - -
- -
    -
  • Filter for a city
  • -
  • or a state
  • -
-
- - - diff --git a/06 - Type Ahead/index.html b/06 - Type Ahead/index.html new file mode 100644 index 0000000000..49460852f4 --- /dev/null +++ b/06 - Type Ahead/index.html @@ -0,0 +1,55 @@ + + + + + Codestin Search App + + + + +
+ +
    +
  • Filter for a city
  • +
  • or a state
  • +
+
+ + + From 8865d09ac2508c249e54c03659fb7179cf6b08b7 Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Wed, 21 Dec 2016 11:04:01 -0500 Subject: [PATCH 6/8] adds from 3 and 6 --- .../{index-START.html => index.html} | 30 ++++++++++++++++++- 06 - Type Ahead/index.html | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) rename 03 - CSS Variables/{index-START.html => index.html} (61%) diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index.html similarity index 61% rename from 03 - CSS Variables/index-START.html rename to 03 - CSS Variables/index.html index bf0f33e3ba..81c83ac949 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index.html @@ -15,7 +15,7 @@

Update CSS Variables with JS

- + @@ -26,6 +26,25 @@

Update CSS Variables with JS

misc styles, nothing to do with CSS variables */ + :root { + --base: #ffc600; + --spacing: 10px; + + } + + h1 { + color: var(--base); + --blur: 0px; + + } + + img { + padding: var(--spacing); + background: var(--base); + filter: blur(var(--blur)); + + } + body { text-align: center; } @@ -53,6 +72,15 @@

Update CSS Variables with JS

diff --git a/06 - Type Ahead/index.html b/06 - Type Ahead/index.html index 49460852f4..5858c9cb4a 100644 --- a/06 - Type Ahead/index.html +++ b/06 - Type Ahead/index.html @@ -33,7 +33,7 @@ const matchArray = findMatches(this.value, cities); const html = matchArray.map(place => { const regex = new RegExp(this.value, 'gi'); - const cityName = place.city.replace(regex, `${this.value}`); + const cityName = place.city.replace(regex, ` ${this.value}`); const stateName = place.state.replace(regex, `${this.value}`); return `
  • From 95047a84d12332d539d1ab4470df1f6b6ed5bcb8 Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Wed, 21 Dec 2016 16:02:12 -0500 Subject: [PATCH 7/8] finish 08 --- 08 - Fun with HTML5 Canvas/index-START.html | 19 ----- 08 - Fun with HTML5 Canvas/index.html | 80 +++++++++++++++++++++ 2 files changed, 80 insertions(+), 19 deletions(-) delete mode 100644 08 - Fun with HTML5 Canvas/index-START.html create mode 100644 08 - Fun with HTML5 Canvas/index.html diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html deleted file mode 100644 index 37c148df07..0000000000 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Codestin Search App - - - - - - - - - diff --git a/08 - Fun with HTML5 Canvas/index.html b/08 - Fun with HTML5 Canvas/index.html new file mode 100644 index 0000000000..1e8da46dcd --- /dev/null +++ b/08 - Fun with HTML5 Canvas/index.html @@ -0,0 +1,80 @@ + + + + + Codestin Search App + + + + + + + + From 30244749324f843caf398707db0ca56ac9ed7e7b Mon Sep 17 00:00:00 2001 From: Bejamin Schachter Date: Wed, 4 Jan 2017 17:19:41 -0500 Subject: [PATCH 8/8] finished w/o filters --- 19 - Webcam Fun/index.html | 4 ++-- 19 - Webcam Fun/scripts.js | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/19 - Webcam Fun/index.html b/19 - Webcam Fun/index.html index d4ffc4dc2a..c66610092b 100755 --- a/19 - Webcam Fun/index.html +++ b/19 - Webcam Fun/index.html @@ -10,7 +10,7 @@
    - +
    diff --git a/19 - Webcam Fun/scripts.js b/19 - Webcam Fun/scripts.js index 00355f5a9c..3f24f7f760 100644 --- a/19 - Webcam Fun/scripts.js +++ b/19 - Webcam Fun/scripts.js @@ -3,3 +3,48 @@ const canvas = document.querySelector('.photo'); const ctx = canvas.getContext('2d'); const strip = document.querySelector('.strip'); const snap = document.querySelector('.snap'); + + +function getVideo() { + navigator.mediaDevices.getUserMedia({ + video: true, + audio: false + }) + .then(localmediastream => { + console.log(localmediastream); + video.src = window.URL.createObjectURL(localmediastream); + video.play(); + }) + .catch(err => console.error(err)); +} + + +function paintToCanvas() { + const width = video.videoWidth; + const height = video.videoHeight; + canvas.width = width; + canvas.height = height; + + return setInterval(() => { + ctx.drawImage(video, 0, 0, width, height); + let pixels = ctx.getImageData(0, 0, width, height); + console.log(pixels); + debugger; + }, 16); +} + +function takePhoto() { + snap.currentTime = 0; + snap.play(); + const data = canvas.toDataURL('image/jpeg'); + + const link = document.createElement('a'); + link.href = data; + link.setAttribute('download', 'handsome'); + link.innerHTML = `person`; + strip.insertBefore(link, strip.firstChild); + +} + +getVideo(); +video.addEventListener('canplay', paintToCanvas);