Skip to content

Commit a94455e

Browse files
committed
init
0 parents  commit a94455e

File tree

93 files changed

+5780
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+5780
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
node_modules/
3+
*.log
4+
haters/
5+
.idea/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS Drum Kit</title>
6+
<link rel="stylesheet" href="style.css">
7+
</head>
8+
<body>
9+
10+
11+
<div class="keys">
12+
<div data-key="65" class="key">
13+
<kbd>A</kbd>
14+
<span class="sound">clap</span>
15+
</div>
16+
<div data-key="83" class="key">
17+
<kbd>S</kbd>
18+
<span class="sound">hihat</span>
19+
</div>
20+
<div data-key="68" class="key">
21+
<kbd>D</kbd>
22+
<span class="sound">kick</span>
23+
</div>
24+
<div data-key="70" class="key">
25+
<kbd>F</kbd>
26+
<span class="sound">openhat</span>
27+
</div>
28+
<div data-key="71" class="key">
29+
<kbd>G</kbd>
30+
<span class="sound">boom</span>
31+
</div>
32+
<div data-key="72" class="key">
33+
<kbd>H</kbd>
34+
<span class="sound">ride</span>
35+
</div>
36+
<div data-key="74" class="key">
37+
<kbd>J</kbd>
38+
<span class="sound">snare</span>
39+
</div>
40+
<div data-key="75" class="key">
41+
<kbd>K</kbd>
42+
<span class="sound">tom</span>
43+
</div>
44+
<div data-key="76" class="key">
45+
<kbd>L</kbd>
46+
<span class="sound">tink</span>
47+
</div>
48+
</div>
49+
50+
<audio data-key="65" src="sounds/clap.wav"></audio>
51+
<audio data-key="83" src="sounds/hihat.wav"></audio>
52+
<audio data-key="68" src="sounds/kick.wav"></audio>
53+
<audio data-key="70" src="sounds/openhat.wav"></audio>
54+
<audio data-key="71" src="sounds/boom.wav"></audio>
55+
<audio data-key="72" src="sounds/ride.wav"></audio>
56+
<audio data-key="74" src="sounds/snare.wav"></audio>
57+
<audio data-key="75" src="sounds/tom.wav"></audio>
58+
<audio data-key="76" src="sounds/tink.wav"></audio>
59+
60+
<script>
61+
function removeTransition(e) {
62+
if (e.propertyName !== 'transform') return;
63+
e.target.classList.remove('playing');
64+
}
65+
66+
function playSound(e) {
67+
const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`);
68+
const key = document.querySelector(`div[data-key="${e.keyCode}"]`);
69+
if (!audio) return;
70+
71+
key.classList.add('playing');
72+
audio.currentTime = 0;
73+
audio.play();
74+
}
75+
76+
const keys = Array.from(document.querySelectorAll('.key'));
77+
keys.forEach(key => key.addEventListener('transitionend', removeTransition));
78+
window.addEventListener('keydown', playSound);
79+
</script>
80+
81+
82+
</body>
83+
</html>
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS Drum Kit</title>
6+
<link rel="stylesheet" href="style.css">
7+
</head>
8+
<body>
9+
10+
11+
<div class="keys">
12+
<div data-key="65" class="key">
13+
<kbd>A</kbd>
14+
<span class="sound">clap</span>
15+
</div>
16+
<div data-key="83" class="key">
17+
<kbd>S</kbd>
18+
<span class="sound">hihat</span>
19+
</div>
20+
<div data-key="68" class="key">
21+
<kbd>D</kbd>
22+
<span class="sound">kick</span>
23+
</div>
24+
<div data-key="70" class="key">
25+
<kbd>F</kbd>
26+
<span class="sound">openhat</span>
27+
</div>
28+
<div data-key="71" class="key">
29+
<kbd>G</kbd>
30+
<span class="sound">boom</span>
31+
</div>
32+
<div data-key="72" class="key">
33+
<kbd>H</kbd>
34+
<span class="sound">ride</span>
35+
</div>
36+
<div data-key="74" class="key">
37+
<kbd>J</kbd>
38+
<span class="sound">snare</span>
39+
</div>
40+
<div data-key="75" class="key">
41+
<kbd>K</kbd>
42+
<span class="sound">tom</span>
43+
</div>
44+
<div data-key="76" class="key">
45+
<kbd>L</kbd>
46+
<span class="sound">tink</span>
47+
</div>
48+
</div>
49+
50+
<audio data-key="65" src="sounds/clap.wav"></audio>
51+
<audio data-key="83" src="sounds/hihat.wav"></audio>
52+
<audio data-key="68" src="sounds/kick.wav"></audio>
53+
<audio data-key="70" src="sounds/openhat.wav"></audio>
54+
<audio data-key="71" src="sounds/boom.wav"></audio>
55+
<audio data-key="72" src="sounds/ride.wav"></audio>
56+
<audio data-key="74" src="sounds/snare.wav"></audio>
57+
<audio data-key="75" src="sounds/tom.wav"></audio>
58+
<audio data-key="76" src="sounds/tink.wav"></audio>
59+
60+
<script>
61+
62+
</script>
63+
64+
65+
</body>
66+
</html>
130 KB
Binary file not shown.
63.4 KB
Binary file not shown.
50.9 KB
Binary file not shown.
15.2 KB
Binary file not shown.
238 KB
Binary file not shown.
429 KB
Binary file not shown.
32.6 KB
Binary file not shown.
5.32 KB
Binary file not shown.
105 KB
Binary file not shown.

01 - JavaScript Drum Kit/style.css

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
html {
2+
font-size: 10px;
3+
background: url(https://i.imgur.com/b9r5sEL.jpg) bottom center;
4+
background-size: cover;
5+
}
6+
7+
body,html {
8+
margin: 0;
9+
padding: 0;
10+
font-family: sans-serif;
11+
}
12+
13+
.keys {
14+
display: flex;
15+
flex: 1;
16+
min-height: 100vh;
17+
align-items: center;
18+
justify-content: center;
19+
}
20+
21+
.key {
22+
border: .4rem solid black;
23+
border-radius: .5rem;
24+
margin: 1rem;
25+
font-size: 1.5rem;
26+
padding: 1rem .5rem;
27+
transition: all .07s ease;
28+
width: 10rem;
29+
text-align: center;
30+
color: white;
31+
background: rgba(0,0,0,0.4);
32+
text-shadow: 0 0 .5rem black;
33+
}
34+
35+
.playing {
36+
transform: scale(1.1);
37+
border-color: #ffc600;
38+
box-shadow: 0 0 1rem #ffc600;
39+
}
40+
41+
kbd {
42+
display: block;
43+
font-size: 4rem;
44+
}
45+
46+
.sound {
47+
font-size: 1.2rem;
48+
text-transform: uppercase;
49+
letter-spacing: .1rem;
50+
color: #ffc600;
51+
}
+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS + CSS Clock</title>
6+
</head>
7+
<body>
8+
9+
10+
<div class="clock">
11+
<div class="clock-face">
12+
<div class="hand hour-hand"></div>
13+
<div class="hand min-hand"></div>
14+
<div class="hand second-hand"></div>
15+
</div>
16+
</div>
17+
18+
19+
<style>
20+
html {
21+
background: #018DED url(https://unsplash.it/1500/1000?image=881&blur=5);
22+
background-size: cover;
23+
font-family: 'helvetica neue';
24+
text-align: center;
25+
font-size: 10px;
26+
}
27+
28+
body {
29+
margin: 0;
30+
font-size: 2rem;
31+
display: flex;
32+
flex: 1;
33+
min-height: 100vh;
34+
align-items: center;
35+
}
36+
37+
.clock {
38+
width: 30rem;
39+
height: 30rem;
40+
border: 20px solid white;
41+
border-radius: 50%;
42+
margin: 50px auto;
43+
position: relative;
44+
padding: 2rem;
45+
box-shadow:
46+
0 0 0 4px rgba(0,0,0,0.1),
47+
inset 0 0 0 3px #EFEFEF,
48+
inset 0 0 10px black,
49+
0 0 10px rgba(0,0,0,0.2);
50+
}
51+
52+
.clock-face {
53+
position: relative;
54+
width: 100%;
55+
height: 100%;
56+
transform: translateY(-3px); /* account for the height of the clock hands */
57+
}
58+
59+
.hand {
60+
width: 50%;
61+
height: 6px;
62+
background: black;
63+
position: absolute;
64+
top: 50%;
65+
transform-origin: 100%;
66+
transform: rotate(90deg);
67+
transition: all 0.05s;
68+
transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1);
69+
}
70+
</style>
71+
72+
<script>
73+
const secondHand = document.querySelector('.second-hand');
74+
const minsHand = document.querySelector('.min-hand');
75+
const hourHand = document.querySelector('.hour-hand');
76+
77+
function setDate() {
78+
const now = new Date();
79+
80+
const seconds = now.getSeconds();
81+
const secondsDegrees = ((seconds / 60) * 360) + 90;
82+
secondHand.style.transform = `rotate(${secondsDegrees}deg)`;
83+
84+
const mins = now.getMinutes();
85+
const minsDegrees = ((mins / 60) * 360) + ((seconds/60)*6) + 90;
86+
minsHand.style.transform = `rotate(${minsDegrees}deg)`;
87+
88+
const hour = now.getHours();
89+
const hourDegrees = ((hour / 12) * 360) + ((mins/60)*30) + 90;
90+
hourHand.style.transform = `rotate(${hourDegrees}deg)`;
91+
}
92+
93+
setInterval(setDate, 1000);
94+
95+
setDate();
96+
97+
</script>
98+
</body>
99+
</html>
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS + CSS Clock</title>
6+
</head>
7+
<body>
8+
9+
10+
<div class="clock">
11+
<div class="clock-face">
12+
<div class="hand hour-hand"></div>
13+
<div class="hand min-hand"></div>
14+
<div class="hand second-hand"></div>
15+
</div>
16+
</div>
17+
18+
19+
<style>
20+
html {
21+
background: #018DED url(http://unsplash.it/1500/1000?image=881&blur=5);
22+
background-size: cover;
23+
font-family: 'helvetica neue';
24+
text-align: center;
25+
font-size: 10px;
26+
}
27+
28+
body {
29+
margin: 0;
30+
font-size: 2rem;
31+
display: flex;
32+
flex: 1;
33+
min-height: 100vh;
34+
align-items: center;
35+
}
36+
37+
.clock {
38+
width: 30rem;
39+
height: 30rem;
40+
border: 20px solid white;
41+
border-radius: 50%;
42+
margin: 50px auto;
43+
position: relative;
44+
padding: 2rem;
45+
box-shadow:
46+
0 0 0 4px rgba(0,0,0,0.1),
47+
inset 0 0 0 3px #EFEFEF,
48+
inset 0 0 10px black,
49+
0 0 10px rgba(0,0,0,0.2);
50+
}
51+
52+
.clock-face {
53+
position: relative;
54+
width: 100%;
55+
height: 100%;
56+
transform: translateY(-3px); /* account for the height of the clock hands */
57+
}
58+
59+
.hand {
60+
width: 50%;
61+
height: 6px;
62+
background: black;
63+
position: absolute;
64+
top: 50%;
65+
}
66+
67+
</style>
68+
69+
<script>
70+
71+
72+
</script>
73+
</body>
74+
</html>

0 commit comments

Comments
 (0)