Skip to content

nickarocho/play-among-the-stars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Play Among the Stars

This is the final result of a 3-hour creative coding interview. The prompt was to "pick an object in the real world which speaks to you and bring it to life using HTML, CSS, and JavaScript".

Comparison

Concept

I live in Los Angeles, and my office is located in the heart of the Hollywood Walk of Fame.

I pass by dozens of these iconic stars every day, but my favorite by far goes to one of my musical idols: Frank Sinatra (who basically ran this city back in the day... and is the only celebrity I know of with not one, but TWO stars to his name. A true legend indeed).

Every time I see this star on my way to work, I can't help but to hear one of his many tunes in my head, so I thought it would be a fun project to express my perspective of this object by bringing it to life and recreating it in the form of good ol' HTML, CSS and JavaScript.

Check It Out

View the Project:

https://nickarocho.github.io/play-among-the-stars/

  • Make sure your sound is on!
  • Also, this looks best on a laptop.

Run the App Locally

To run the app locally, clone this repo using the command line:

$ git clone https://github.com/nickarocho/play-among-the-stars

Open the index.html file using Google Chrome or Firefox.

(still working on cross-browser compatibility)

Technologies Used

  • HTML
  • CSS
  • JavaScript

Next Steps

I only had three hours to build this (which is cruel, because I was having a blast working on this and just want to keep going by adding more features and perfecting the rendering), so needeless to say, there are some definite improvements that can be made in the form of: more features, bug fixes, performance and responsiveness.

Here's what I would do next:

  • Fix the animation timing chain approach
    • Since I was under the gun with time, I used a sloppy setTimeout approach, which isn't good. I would rework this to fire the animation chain synchronously.
  • Add more tracks
    • I originally wanted to be able to click on a certain letter of his name which would respectively play a tune that starts with that letter (i.e. 'S' would trigger 'Summerwind')
    • Add two more controls that would play the next or previous tune
    • It would be really cool to animate a new vinyl going on the player for a new track, or the arm moving to a different point like a real record player
  • Make it look better on mobile devices
    • While I did my best to make this app responsive by using viewport units and percentages wherever possible in the CSS, it isn't quite perfect on super small screens
  • Refine the styles to perfectly match the original photo
    • Add the coarse, grainy sparkle texture to the ground and the terrazo/brass texture to the star
      • I initially gave this a shot, but it took away from my alotted time, so I through that feature in the icebox and went with a flat look instead
    • Add the lines which frame the star
      • CSS Grid would be perfect for this
    • Fix the spacing of the vinyl record (the original has some wider spacing in between the vinyl itself and the border surrounding it)
    • Add the little circle that represents the record player's needle
      • It probably just needs another tiny <div class="circle"> attached to the arm, but I ran out of time.
    • Fix the colors of the vinyl record
      • I started with a flat color (as is in the photo), but needed to add a gradient to show it spinning.
      • There is a subtle, grainy shadow on the border of the vinyl which I would love to recreate but ran out of time
  • Fix the bugs
    • A couple bugs in here are driving me crazy:
      • In Chrome, the record player's arm's border gets all wacky during an animation event
      • I think maybe the position: absolute of the star itself or some other funky bug is causing the body to not display at 100vh, even when it is set to that value.
      • The circles get oddly skewed as the animation begins. I have a feeling this is due to me setting the width/height dynamically depending on the viewport size, so in retrospect it probably would have been better to go with SVG's instead of pure CSS.
  • Simplify the CSS
    • While I feel I was as concise as possible while styling this, especially with utility classes for the many divs using .flex-center {display: flex; align-content: center; justify-content: center} and the .circle: {border-radius: 50%}, there are definitely ways I could use pseudo-classes and better nesting in the HTML to dry up / simplify the CSS
  • Simplify the JavaScript
    • I stuck with the methods I use the most for events and interactivity, but there are surely other more elegant ES6 features I could utilize to simplify the functions, which would in turn boost the performance
    • I chose to go with the setTimeout route for the animation/play sequence, but it would probably be cleaner and easier to alter timing in the future with specific event listeners based on DOM Events like transitionend or play or ended, etc.
  • Add more interactivity
    • I would love to show the lyrics of the track beneath the star while the audio plays.
    • Maybe add a button that displays a modal pop up with Frank's bio.
    • Create some more natural animations
      • It would be really cool to link the animations to the soundwaves of the audio track itself.
  • Expand the app to show more stars
    • I definitely had to reel myself in when I started thinking of what this could be. How cool would it be to basically recreate the entire Walk of Fame, so a user could click a "Forward" or "Back" button, which brings them to the actual next star on the street, then click play and if the star belongs to a:
      • Musician like Frank, animate the record player but play a track of the respective musician
      • Film or TV star, have the projector play a famous clip of theirs
      • Radio star, animate the microphone as a well-known voice-over sample plays
  • Create an augmented reality app
    • Pretty out there, I know, but how awesome would it be to be able to hold your phone over a star, and it animates the star right in front of your eyes? A guy can dream, can't he?!

Thank you!

Thanks for taking the time to check out my project. Please let me know if you have any suggestions as to how I can make this better in any way!