Skip to content

Commit 6b8d6a5

Browse files
authored
Merge pull request #253 from ayushseth07/patch
drumkit darkmode
2 parents 9c6b718 + 8b705d8 commit 6b8d6a5

20 files changed

+434
-0
lines changed

DRUM(darkmode)/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h1>DRUM KIT</h1>
2+
3+
<p>Basic Drum Kit made using HTML, CSS, and JavaScript .</p>
4+
5+
### DRUM :
6+
7+
<p>This web app allows you to make your own music with all the beats that are present in the app. You can click on the alphabets or the images that are present on the screen and enjoy the beats. You can also use your keyboard keys to make the music.</p>
8+
9+
<h3>Used Technologies</h3>
10+
<ul>
11+
<li>HTML5</li>
12+
<li>CSS3</li>
13+
<li>JavaScript</li>
14+
</ul>
15+
16+
#### Steps to Use:
17+
18+
---
19+
20+
- Download or clone the repository
21+
22+
```
23+
git clone https://github.com/Ayushparikh-code/Web-dev-mini-projects.git
24+
```
25+
26+
- Go to the directory
27+
- Run the index.html file
28+
- Start Using The DRUM
29+
30+
<h3>ScreenShots</h3>
31+
<br>
32+
<img src="https://github.com/ayushseth07/Web-dev-mini-projects/blob/patch/todolist/images/drumkit(dark).PNG"/>
33+
<img src="https://github.com/ayushseth07/Web-dev-mini-projects/blob/patch/todolist/images/drumkit(light).PNG"/>

DRUM(darkmode)/app.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
window.addEventListener('load', () => {
2+
const sounds = document.querySelectorAll('.sound');
3+
const pads = document.querySelectorAll('.pads div');
4+
const kit = document.querySelector('.kit');
5+
6+
pads.forEach((pad, index) => {
7+
pad.addEventListener('click', function() {
8+
sounds[index].currentTime = 0;
9+
sounds[index].play();
10+
});
11+
});
12+
13+
//the drum can be played with the keys A.S,D,J,K,L
14+
document.addEventListener("keydown", function(event) {
15+
makeSound(event.key);
16+
buttonAnimation(event.key);
17+
});
18+
19+
function makeSound(key) {
20+
switch (key) {
21+
case 'a':
22+
var closed_hithat = new Audio('sounds/sound1.mp3');
23+
closed_hithat.play();
24+
break;
25+
case 's':
26+
var kick = new Audio('sounds/sound3.mp3');
27+
kick.play();
28+
break;
29+
case 'd':
30+
var clap = new Audio('sounds/sound4.mp3');
31+
clap.play();
32+
break;
33+
case 'j':
34+
var open_hithat = new Audio('sounds/sound5.mp3');
35+
open_hithat.play();
36+
break;
37+
case 'k':
38+
var snare = new Audio('sounds/sound6.mp3');
39+
snare.play();
40+
break;
41+
case 'l':
42+
var crash = new Audio('sounds/sound2.mp3');
43+
crash.play();
44+
break;
45+
}
46+
}
47+
48+
49+
function buttonAnimation(currentKey) {
50+
var activeButton = document.querySelector("." + currentKey);
51+
activeButton.classList.add("pressed");
52+
setTimeout(function() {
53+
activeButton.classList.remove("pressed");
54+
}, 100);
55+
};
56+
});
57+
const themeSwitch = document.querySelector('input');
58+
59+
themeSwitch.addEventListener('change', () => {
60+
document.body.classList.toggle('dark-theme');
61+
});

DRUM(darkmode)/images/band.jpg

5.46 MB
Loading

DRUM(darkmode)/images/clap.png

3.12 KB
Loading
853 Bytes
Loading

DRUM(darkmode)/images/crash.png

1.11 KB
Loading
99.8 KB
Loading
99.2 KB
Loading

DRUM(darkmode)/images/kick.png

3.16 KB
Loading

DRUM(darkmode)/images/open-hihat.png

864 Bytes
Loading

0 commit comments

Comments
 (0)