Coder Social home page Coder Social logo

drums's Introduction

Drums Project

by M. Bambalan

Technologies used:

  • HTML5
  • CSS3
    • CSS Grid
    • Animations and Transitions
    • Media Queries
    • Font Awesome
  • Vanilla Javascript

Dev's Reflection

I started this project to learn and practice DOM manipulation using vanilla Javascript.

If you see the code, the HTML code is very minimal. It is a boilerplate of HTML5. I just linked both CSS and JS script inside this HTML file.

The CSS file is very minimal as well. I used it for basic styling. I implemented CSS grid to manipulate the bahavior of the drum tiles. I tried doing CSS grid with repeat(auto-fit, minmax()), but the GUI did not look good when the drum tiles were cut off. Instead, I used media queries.

I plan on learning CSS preprocessors (such as SASS) and implementing naming standards such as BEM.

Since this project focuses on learning and practicing DOM manipulation, the Javascript file is the longest.

I used it to build most of the HTML elements with my drumSet function. I also listed an object of data (see data) to reduce repetitive lines of codes.

I added an eventlistener for keydown and mouse clicks that trigger the playDrum function.

Inside this function, I separated the keydown and the click events that trigger the sounds. The click event was more challenging since I needed to figure out which element was clicked and which sound corresponds to that element.

It was the first time I handled audio files. The first problem I encountered with audio files is compatibility. Some just does not work with Mozilla Firefox. Next, the audio needed to finish first before it can trigger another beat. Double beat was not possible until I set the currentTime to 0 before playing the audio file.

Lastly, I wanted it to look more dynamic. When a drum tile is clicked, it should visually respond to the command. So, I added the 'playing' class that has a transition. One problem, however, is I cannot dynamically add and remove the 'playing' class. So, I added an 'transitionend' eventlistener that triggers the removeClass function.

What the Dev want to learn more about

I want to master DOM manipulation by practicing more JS. SASS and BEM are good additions, too. I want to learn writing Javascript more efficiently. The lesser the code, the better. Looking forward to more fun projects.

Commits

01/27/2021 - Initial Commit

I pushed my first commit. The tink.wav [KeyK] was not working inside Mozilla Firefox (inside my Ubuntu virtualbox). The console was throwing a warning that says:

Cannot play media. No decoders for requested formats: audio/x-wav, audio/x-wav, audio/x-wav, audio/x-wav

I had to try it out on Google Chrome on Windows. It turns out that it is working perfectly fine.

I need to work on the user interface next.

01/28/2021

Initial commit only has keyboard compatibility and an ugly UI. So I added a mouse compatibility for mobile users and a decent GUI with transitions.

Also, the background image is not showing on Google Chrome. It was fully working inside Mozilla Firefox. Fixed its directory by adding '.' in front.

Lastly, I added a title to complete this fun project.

02/09/2021 Revamped the UI. Added footer and a link to this github repo!

Added FontAwesome. Added animations and transitions.

This project is a part of The Odin Project Curriculum

drums's People

Contributors

madobyte avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.