Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
IshaSaini11 authored Apr 6, 2024
1 parent 47edb17 commit ef6a9d8
Show file tree
Hide file tree
Showing 17 changed files with 188 additions and 0 deletions.
Binary file added images/crash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/kick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/snare.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tom1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tom2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tom3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tom4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
<meta charset="utf-8">
<title>Drum Kit</title>
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Arvo" rel="stylesheet">
</head>

<body>

<h1 id="title">Drum Kit🥁</h1>
<div class="set">
<button class="w drum">w</button>
<button class="a drum">a</button>
<button class="s drum">s</button>
<button class="d drum">d</button>
<button class="j drum">j</button>
<button class="k drum">k</button>
<button class="l drum">l</button>
</div>


<footer>
Let your inner Rockstar Rock!
</footer>
<script src="index.js" charset="utf-8"></script>
</body>

</html>
76 changes: 76 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//for mouse press
var numberOfDrumButtons = document.querySelectorAll(".drum").length;

for (var i=0; i<numberOfDrumButtons; i++){

document.querySelectorAll(".drum")[i].addEventListener("click", function(){
// this.style.color = "black";
var buttonInnerHTML = this.innerHTML;

sound(buttonInnerHTML);

buttonAnimation(buttonInnerHTML);
})
}

//for keyboard press
document.addEventListener("keydown", function(event) {

sound(event.key);

buttonAnimation(event.key);

});

function sound(key){

switch (key) {
case "w":
var tom1 = new Audio('sounds/tom-1.mp3');
tom1.play();
break;

case "a":
var tom2 = new Audio('sounds/tom-2.mp3');
tom2.play();
break;

case "s":
var crash = new Audio('sounds/crash.mp3');
crash.play();
break;

case "d":
var kick = new Audio('sounds/kick-bass.mp3');
kick.play();
break;

case "j":
var snare = new Audio('sounds/snare.mp3');
snare.play();
break;

case "k":
var tom3 = new Audio('sounds/tom-3.mp3');
tom3.play();
break;

case "l":
var tom4 = new Audio('sounds/tom-4.mp3');
tom4.play();
break;
default: console.log(buttonInnerHTML);
break;
}
}

function buttonAnimation(currentkey){

var activeButton = document.querySelector("." + currentkey)

activeButton.classList.add("pressed");

setTimeout(function(){
activeButton.classList.remove("pressed");
}, 100);
}
Binary file added sounds/crash.mp3
Binary file not shown.
Binary file added sounds/kick-bass.mp3
Binary file not shown.
Binary file added sounds/snare.mp3
Binary file not shown.
Binary file added sounds/tom-1.mp3
Binary file not shown.
Binary file added sounds/tom-2.mp3
Binary file not shown.
Binary file added sounds/tom-3.mp3
Binary file not shown.
Binary file added sounds/tom-4.mp3
Binary file not shown.
81 changes: 81 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
body {
text-align: center;
background-color: #717a92;
}

h1 {
font-size: 5rem;
color: #DBEDF3;
font-family: "Arvo", cursive;
text-shadow: 3px 0 #8b4062;

}

footer {
color: #DBEDF3;
font-family: sans-serif;
}

.w {
background-image: url(./images/tom1.png);
}

.a {
background-image: url(./images/tom2.png);
}

.s {
background-image: url(./images/crash.png);
}

.d {
background-image: url(./images/kick.png);
}

.j {
background-image: url(./images/snare.png);
}

.k {
background-image: url(./images/tom3.png);
}

.l {
background-image: url(./images/tom4.png);
}

.set {
margin: 10% auto;
}

.game-over {
background-color: rgb(201, 43, 43);
opacity: 0.8;
}

.pressed {
box-shadow: 0 3px 4px 0 #DBEDF3;
opacity: 0.5;
}

.red {
color: red;
}

.drum {
outline: none;
border: 10px solid #404B69;
font-size: 5rem;
font-family: 'Arvo', cursive;
line-height: 2;
font-weight: 900;
color: #050202;
text-shadow: 3px 0 #DBEDF3;
border-radius: 15px;
display: inline-block;
width: 150px;
height: 150px;
text-align: center;
margin: 10px;
background-color: white;
}

0 comments on commit ef6a9d8

Please sign in to comment.