loading...
Cover image for 🎮 CSS Nintendo Switch (Box Shadow & Gradient Practice)

🎮 CSS Nintendo Switch (Box Shadow & Gradient Practice)

acupoftee profile image Elisabeth Diang 🌻 Updated on ・1 min read

Hello world. I've missed you all. I hope you all are happy, healthy, and well ❤️

After some major life changes and enormous projects, it's great to be back! I'm conjuring up on a new animation video involving the Nintendo Switch 😊 I wanted to improve my use of box-shadows, so I challenged myself to make a realistic looking Switch. My fiancé then had the splendid idea of showing gameplay on the screen--what an ideal opportunity to spread more ACNH euphoria!

It was gratifying to apply box-shadows meticulously. I look forward to sharing the Switch animation when it's done. There were some fun challenges and learning outcomes I'm itching to share with this animation video.

I'll document my process differently, with an accompanying article on DEV. Now that my schedule's subsided, I can't wait to share more content with you all.

Please don't hesitate to reach out if you have any questions 😊 Have a great day!

🖼 CodePen 🎥 YouTube 👩🏾‍💻 GitHub 🎀 Instagram

Discussion

pic
Editor guide
Collapse
bramleydev profile image
Anthony Bramley

Woah! I need a map of where you got all of that time, patience, and talent from! What you've done with just CSS is amazing to me, especially since I tried this a while back and failed worse than you'd be able to imagine. I hope to see you do more great things with CSS like this in the near future!

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Thank you for the kind words Anthony!

I need a map of where you got all of that time, patience, and talent from!

The patience, time, and results came from the will to try and have fun! Failure is unnerving, but it's how we view and handle failure that makes a difference. View it as a learning experience. Ask yourself why this outcome took place instead of the desired outcome. More importantly, have fun with the process! Once you learn the basics, see what you can come up with. I learned most of what I know from MDN's CSS Basics article, and MDN's CSS Concepts page. Once I got the basics, I just had fun with it. Haha people totally judged me at first, but that didn't stop me from doing it. I was learning and having fun! You know what they say, "Creativity is intelligence having fun." You can do it. Take your time with it, don't compare yourself to others, let yourself have fun with the learning process, and style away! Best of luck. 🙂

Collapse
raghavmisra profile image
Raghav Misra

Hey Bramley

Collapse
nickytonline profile image
Nick Taylor (he/him)

This looks amazing! 🔥 👏🏻

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Thank you so much Nick! It was exciting to work on. It was a nice way to train my eye to visualize shadows with CSS too.

Collapse
greedybrain profile image
Naya Willis

The gameplay is CSS too? Or just the switch?

Collapse
squidbe profile image
squidbe

The gameplay is a video (see the source code). If it were CSS, my head would explode. 🤯

Collapse
greedybrain profile image
Naya Willis

Absolutely

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

That is correct, the gameplay is a video 🙂

CSS gameplay a great idea!

Collapse
jack_garrus profile image
Nadia G.

Simply impressive. Good job!

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Thank you Naida! :D

Collapse
nandorholozsnyak profile image
Nándor Holozsnyák

Absolutely amazing! Good job. Sometimes I can not understand what CSS is capable :D

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Thank you Nándor!

Sometimes I can not understand what CSS is capable

Same here. It's mind boggling seeing intricate and immersive visuals produced with CSS.

Collapse
tatianacodes profile image
Tatiana

I have to try this.

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Totally! Box shadows are so much fun. A random object around the house is a good start, or something off of an image. Mozilla Developer Network is a handy resource for experimenting with properties as well. Have fun! Look forward to seeing what you come up with 🙂

Collapse
darryl profile image
Darryl Young

This is brilliant! Great work, Elisabeth.

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Thank you Darryl!

Collapse
squidbe profile image
squidbe

The shadows were the hard part?! 😳

Awesome job!

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Thank you squid! They totally were at first since I didn't use them to its full potential until now. Once I figured out how to translate the shadows from my reference as meticulously as possible with the right units, it became so much easier. 🙂

Collapse
greedybrain profile image
Naya Willis

You the best Dj Khaled voice

Collapse
martincleto profile image
S. Martín-Cleto

You are definitely talented, I love it! Mis dieces.

Collapse
acupoftee profile image
Collapse
jsdawson profile image
jsdawson

Wow, great work! The video wouldn't play (Chrome) until I added the muted="muted" attribute value to the <video>.

Collapse
acupoftee profile image
Elisabeth Diang 🌻 Author

Thank you very much! Thank you for sharing the bug as well. I just patched it on CodePen with the muted attribute. The audio worked when I added the playsinline attribute (I don't feel the audio is necessary. I was just curious lol).

I looked into it further. It turns out Chrome updated their autoplay policy for UX improvements:

...web browsers are moving towards stricter autoplay policies in order to improve the user experience, minimize incentives to install ad blockers, and reduce data consumption on expensive and/or constrained networks.

Another interesting tidbit is Chrome uses a Media Engagement Index (MEI), which is the ratio of visits to media playback events emitted, to determine if a video should play automatically. That's why autoplay still works on sites like YouTube, Instagram, etc. Pretty neat!

I'll add this snippet in the code so that ACNH fans can enjoy the intro audio if they wish.

<video id="video" muted autoplay>
<button id="unmuteButton"></button>

<script>
  unmuteButton.addEventListener('click', function() {
    video.muted = false;
  });
</script>