Skip to content

Commit 8300f18

Browse files
committed
Drums project added
1 parent 49e6612 commit 8300f18

File tree

12 files changed

+125
-0
lines changed

12 files changed

+125
-0
lines changed

drums/bgd.jpg

218 KB
Loading

drums/drums.html

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" width="device-width" initial-scale="1.0">
7+
<title>DRUMS</title>
8+
<link rel="stylesheet" href="style.css">
9+
</head>
10+
11+
<body>
12+
<div class="container">
13+
<div data-key="65" class="key" id="key">
14+
<kbd>A</kbd>
15+
<span class="sound">BOOM</span></div>
16+
<div data-key="83" class="key">
17+
<kbd>S</kbd>
18+
<span class="sound">CLAP</span> </div>
19+
<div data-key="68" class="key">
20+
<kbd>D</kbd>
21+
<span class="sound">HIHAT</span> </div>
22+
<div data-key="70" class="key">
23+
<kbd>F</kbd>
24+
<span class="sound">KICK</span> </div>
25+
<div data-key="71" class="key">
26+
<kbd>G</kbd>
27+
<span class="sound">OPENHAT</span> </div>
28+
<div data-key="72" class="key">
29+
<kbd>H</kbd>
30+
<span class="sound">RIDE</span> </div>
31+
<div data-key="74" class="key">
32+
<kbd>J</kbd>
33+
<span class="sound">SNARE</span></div>
34+
<div data-key="75" class="key">
35+
<kbd>K</kbd>
36+
<span class="sound">TINK</span> </div>
37+
<div data-key="76" class="key">
38+
<kbd>L</kbd>
39+
<span class="sound">TOM</span></div>
40+
</div>
41+
<audio data-key="65" src="sounds/boom.wav"></audio>
42+
<audio data-key="83" src="sounds/clap.wav"></audio>
43+
<audio data-key="68" src="sounds/hihat.wav"></audio>
44+
<audio data-key="70" src="sounds/kick.wav"></audio>
45+
<audio data-key="71" src="sounds/openhat.wav"></audio>
46+
<audio data-key="72" src="sounds/ride.wav"></audio>
47+
<audio data-key="74" src="sounds/snare.wav"></audio>
48+
<audio data-key="75" src="sounds/tink.wav"></audio>
49+
<audio data-key="76" src="sounds/tom.wav"></audio>
50+
51+
<script>
52+
var i;
53+
54+
function addsound(e) {
55+
var audio = document.querySelector(`audio[data-key="${e.keyCode}"]`);
56+
var key = document.querySelector(`.key[data-key="${e.keyCode}"]`);
57+
if (!audio) return;
58+
audio.currentTime = 0;
59+
audio.play();
60+
/* var jq = $.noConflict();
61+
$(window).keydown(function() {
62+
key.addClass("playing");
63+
});*/
64+
key.classList.add('playing');
65+
}
66+
67+
function removeTransition(e) {
68+
this.classList.remove('playing');
69+
}
70+
71+
const keys = Array.from(document.querySelectorAll(".key"));
72+
keys.forEach(key => key.addEventListener('transitionend', removeTransition))
73+
window.addEventListener('keydown', addsound);
74+
</script>
75+
76+
</html>

drums/sounds/boom.wav

130 KB
Binary file not shown.

drums/sounds/clap.wav

63.4 KB
Binary file not shown.

drums/sounds/hihat.wav

50.9 KB
Binary file not shown.

drums/sounds/kick.wav

15.2 KB
Binary file not shown.

drums/sounds/openhat.wav

238 KB
Binary file not shown.

drums/sounds/ride.wav

429 KB
Binary file not shown.

drums/sounds/snare.wav

32.6 KB
Binary file not shown.

drums/sounds/tink.wav

5.32 KB
Binary file not shown.

drums/sounds/tom.wav

105 KB
Binary file not shown.

drums/style.css

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
background: url(bgd.jpg) no-repeat;
5+
overflow-x: hidden;
6+
background-size: cover;
7+
font-family: sans-serif;
8+
}
9+
10+
.container {
11+
padding-top: 300px;
12+
width: 100%;
13+
border: 2px solid black;
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
17+
}
18+
19+
.key {
20+
padding: 5px;
21+
margin-right: 5px;
22+
border: 4px solid grey;
23+
border-radius: 15px;
24+
text-align: center;
25+
transition: all 0.2s ease-in-out;
26+
width: 10%;
27+
align-self: center;
28+
text-shadow: 2px 2px 2px red;
29+
background: rgba(0, 0, 0, 0.5);
30+
}
31+
32+
kbd {
33+
display: block;
34+
font:italic bold 50px monospace;
35+
color: white;
36+
}
37+
38+
.sound {
39+
font-size: 20px;
40+
color: red;
41+
word-wrap: nowrap;
42+
}
43+
44+
.playing {
45+
border-color:orange;
46+
box-shadow: 2px 2px 15px orange;
47+
48+
transform: scale(1.1, 1.1);
49+
}

0 commit comments

Comments
 (0)