Project #10: Javascript piano

>_< 1girl asymmetrical_horns bird black_flower black_gloves black_hair black_horns black_jacket black_skirt black_sleeves blue_hair breasts closed_eyes closed_mouth clothing_cutout collared_shirt colored_inner_hair commentary crow demon_horns detached_sleeves english_commentary floating_hair flower gloves grand_piano hair_ornament heart heart-shaped_eyes highres hololive hololive_english horn_flower horns instrument jacket jailbird_(nerissa_ravencroft) large_breasts long_hair looking_at_viewer mole mole_under_eye multicolored_hair musical_staff nerissa_ravencroft nerissa_ravencroft_(1st_costume) piano red_eyes shadow_(nerissa_ravencroft) sheet_music shirt shoulder_cutout sitting skirt solo sparkle tassel tassel_hair_ornament two-tone_hair uneven_horns very_long_hair virtual_youtuber white_shirt xiisalt

Link

Estimated date of creation: December 2022

Status: Online 🟢

This is a playable piano keyboard for your browser. But it is pretty simple. It’s pretty much the same onClick button system as I used in the meme soundboard. I did also use event listeners though, which wait for a key to be pressed. So you can use your text keyboard to play the piano. But I also didn’t map every key, it seems. And also, for some reason, when the note is pressed with your computer keyboard key, it doesn’t visually go down. But it visually goes down if you use your mouse to click on the key. So that’s weird.

In the Javascript, everything that isn’t the first 4 lines in that file was about mapping the computer keyboard so it would play the piano.

For some reason, I have an AJAX/JQuery download in my html head, but I don’t think those were used in this at all.

The piano shape was based on the piano we had to draw out of CSS in the FreeCodeCamp course. They don’t teach about how to turn it into an instrument, though. That was just putting rectangles next to each other. I had to learn about event listeners from StackOverflow quite a bit. And I spent a lot of time reading about them on MDN.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *