Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
devvsakib committed Oct 12, 2022
1 parent ad09c9e commit d6b2a17
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 65 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
/clone-disney
/portfolio-devvsakib
/travel-api-app
TutReact.code-workscpace
File renamed without changes.
120 changes: 60 additions & 60 deletions PROJECTS/index.js → PROJECTS/Drum Kit/index.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
var noofdrumbuttton = document.querySelectorAll(".drum").length;
for(var i=0;i<noofdrumbuttton;i++){
document.querySelectorAll(".drum")[i].addEventListener("click", function() {
var buttonInnerHTML = this.innerHTML;
makesound(buttonInnerHTML);
buttonanimation(buttonInnerHTML);
});
}

document.addEventListener("keypress",function(event){
makesound(event.key);
buttonanimation(event.key)
});

function makesound(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 tom3 = new Audio('sounds/tom-3.mp3');
tom3.play();
break;

case "d":
var tom4 = new Audio('sounds/tom-4.mp3');
tom4.play();
break;
case "j":
var snare = new Audio('sounds/snare.mp3');
snare.play();
break;

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

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

default:
console.log(buttonInnerHTML);
}
}

function buttonanimation(currentkey){
var activebutton = document.querySelector("." + currentkey);
activebutton.classList.add("pressed");

setTimeout(function(){
activebutton.classList.remove("pressed"),1
});
var noofdrumbuttton = document.querySelectorAll(".drum").length;
for(var i=0;i<noofdrumbuttton;i++){
document.querySelectorAll(".drum")[i].addEventListener("click", function() {
var buttonInnerHTML = this.innerHTML;
makesound(buttonInnerHTML);
buttonanimation(buttonInnerHTML);
});
}

document.addEventListener("keypress",function(event){
makesound(event.key);
buttonanimation(event.key)
});

function makesound(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 tom3 = new Audio('sounds/tom-3.mp3');
tom3.play();
break;

case "d":
var tom4 = new Audio('sounds/tom-4.mp3');
tom4.play();
break;
case "j":
var snare = new Audio('sounds/snare.mp3');
snare.play();
break;

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

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

default:
console.log(buttonInnerHTML);
}
}

function buttonanimation(currentkey){
var activebutton = document.querySelector("." + currentkey);
activebutton.classList.add("pressed");

setTimeout(function(){
activebutton.classList.remove("pressed"),1
});
}
File renamed without changes.
1 change: 0 additions & 1 deletion PROJECTS/read me.js

This file was deleted.

0 comments on commit d6b2a17

Please sign in to comment.