-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file was deleted.
Oops, something went wrong.