diff --git a/Drum/aditya7302/README.md b/Drum/aditya7302/README.md new file mode 100644 index 000000000..ec953533e --- /dev/null +++ b/Drum/aditya7302/README.md @@ -0,0 +1,3 @@ +This is a simple drum kit project using html, css and js to implement drum kit sound. +It is very simple to implement and use just click on the html file and it will work. +![ScreenShot](image.png) \ No newline at end of file diff --git a/Drum/aditya7302/css/styles.css b/Drum/aditya7302/css/styles.css new file mode 100644 index 000000000..fa325fc13 --- /dev/null +++ b/Drum/aditya7302/css/styles.css @@ -0,0 +1,48 @@ +body{ + margin: 0; + display: flex; + flex-direction: column; + align-items: center; + height: 100vh; + justify-content: center; + background-color: pink; +} + +h1{ + font-size: 50px; + font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; + letter-spacing: 4px; + color: white; + text-shadow: 2px 2px 4px rgba(0,0,0,0.3); + white-space: nowrap; +} + +.container{ + text-align: center; +} + +.btn{ + padding: 30px 50px; + background-color: white; + border: none; + margin: 10px; + font-size: 30px; + min-width: 200px; + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0,0,0,0.3); + background-image: url("/javascript_projects/drum_kits/img/tom.png"); + background-size: cover; + color: white; + font-family: cursive; + text-shadow: 2px 2px 4px rgba(0,0,0,0.3); + cursor: pointer; + text-transform: capitalize; +} + +.btn:hover{ + color: pink; +} + +.btn:active{ + background-size: 105%; +} \ No newline at end of file diff --git a/Drum/aditya7302/image.png b/Drum/aditya7302/image.png new file mode 100644 index 000000000..ac52b0820 Binary files /dev/null and b/Drum/aditya7302/image.png differ diff --git a/Drum/aditya7302/img/crash.png b/Drum/aditya7302/img/crash.png new file mode 100644 index 000000000..a992fa0f5 Binary files /dev/null and b/Drum/aditya7302/img/crash.png differ diff --git a/Drum/aditya7302/img/kick.png b/Drum/aditya7302/img/kick.png new file mode 100644 index 000000000..b64877e70 Binary files /dev/null and b/Drum/aditya7302/img/kick.png differ diff --git a/Drum/aditya7302/img/snare.png b/Drum/aditya7302/img/snare.png new file mode 100644 index 000000000..1e089bacd Binary files /dev/null and b/Drum/aditya7302/img/snare.png differ diff --git a/Drum/aditya7302/img/tom.png b/Drum/aditya7302/img/tom.png new file mode 100644 index 000000000..855b21117 Binary files /dev/null and b/Drum/aditya7302/img/tom.png differ diff --git a/Drum/aditya7302/index.html b/Drum/aditya7302/index.html new file mode 100644 index 000000000..04ef99671 --- /dev/null +++ b/Drum/aditya7302/index.html @@ -0,0 +1,21 @@ + + + + + + + + + + Drum Kits + + +

Drum Kits + +

+
+ + +
+ + \ No newline at end of file diff --git a/Drum/aditya7302/index.js b/Drum/aditya7302/index.js new file mode 100644 index 000000000..3963920f1 --- /dev/null +++ b/Drum/aditya7302/index.js @@ -0,0 +1,25 @@ +const kits = ["crash" , "kick", "snare", "tom"]; +const containerEl = document.querySelector(".container"); + +kits.forEach((kit)=>{ + const btnEl = document.createElement("button"); + btnEl.classList.add("btn"); + btnEl.innerText = kit; + btnEl.style.backgroundImage = "url(img/"+kit+".png)"; + containerEl.appendChild(btnEl); + const audioEl = document.createElement("audio"); + audioEl.src = "sound/"+kit+".mp3"; + containerEl.appendChild(audioEl); + btnEl.addEventListener("click",()=>{ + audioEl.play(); + }); + window.addEventListener("keydown",(event)=>{ + if(event.key === kit.slice(0,1)){ + audioEl.play(); + btnEl.style.transform = "scale(0.9)"; + setTimeout(()=>{ + btnEl.style.transform = "scale(1)"; + },100) + } + }) +}); \ No newline at end of file diff --git a/Drum/aditya7302/sound/crash.mp3 b/Drum/aditya7302/sound/crash.mp3 new file mode 100644 index 000000000..d56806269 Binary files /dev/null and b/Drum/aditya7302/sound/crash.mp3 differ diff --git a/Drum/aditya7302/sound/kick.mp3 b/Drum/aditya7302/sound/kick.mp3 new file mode 100644 index 000000000..faf06c6ce Binary files /dev/null and b/Drum/aditya7302/sound/kick.mp3 differ diff --git a/Drum/aditya7302/sound/snare.mp3 b/Drum/aditya7302/sound/snare.mp3 new file mode 100644 index 000000000..e7cf5b841 Binary files /dev/null and b/Drum/aditya7302/sound/snare.mp3 differ diff --git a/Drum/aditya7302/sound/tom.mp3 b/Drum/aditya7302/sound/tom.mp3 new file mode 100644 index 000000000..7dc3003d0 Binary files /dev/null and b/Drum/aditya7302/sound/tom.mp3 differ