Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

<div class="keys">
<div data-key="65" class="key">
<kbd>A</kbd>
<kbd>!</kbd>
<span class="sound">clap</span>
</div>
<div data-key="83" class="key">
<kbd>S</kbd>
<kbd>J</kbd>
<span class="sound">hihat</span>
</div>
<div data-key="68" class="key">
Expand Down Expand Up @@ -58,9 +58,25 @@
<audio data-key="76" src="sounds/tink.wav"></audio>

<script>
// X log keys pressed to console
// X log data-key to console
// X Add class of playing to div by key #
// X Add audio.play
document.addEventListener('keydown', logKey);

function logKey(e) {
const currentKey = e.keyCode;
console.log(currentKey);
let playNow = document.querySelector(`audio[data-key="${currentKey}"]`);
let keyFront = document.querySelector(`div[data-key="${currentKey}"]`);
keyFront.classList.add("playing");
playNow.play()

}

</script>



</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
</style>

<script>
// get current time
// ? rotate hand based on time
// transform: rotate(Xdeg);
// transofmr: origin


</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
</style>

<script>
// update variables with JS!

</script>

</body>
Expand Down