From our sponsor: Agent.ai Builder is now open—no waitlist. Explore 12+ foundation models, no-code to full-code. Free!
Today we’d like to share a fun little experiment with you: a geeky “try-on” sunglasses effect. It’s not a “try-on” in the classical sense for previewing how the sunglasses might look on a person, but instead how the view looks like when putting on some sunglasses and looking through them. For that we use a simple overlay effect and some animations to mimic the movement you do when you try on glasses from the first person perspective.
This is just a fun experimental demo where we use lots of Flexbox for the layouts and CSS Animations controlled by a class logic in our script.
The first view of the demo is the grid of all sunglasses. Once you click on one, a “swoosh” animation happens and we can see a little loader (just dummy loading). Another swoosh animation reveals the single sunglasses preview where you can see the large version of the glasses being animated in a way to mimic the movement of putting them on. A semi-transparent overlay appears that shows the view through the sunglasses. The navigation allows to put on the next or previous sunglasses, and also to hide the overlay.
Tiny break: 📬 Want to stay up to date with frontend and trends in web design? Check out our Collective and stay in the loop.
When hovering the bottom part of the page, close to the edge, the sunglasses “slide off”. This is being indicated by a little “be cool” text at the bottom.
We hope you enjoy this little experiment and find it inspiring!
References and Credits
- Glasses frames from Freepik: Glasses 1, Glasses 2
- Small glasses from Vecteezy: Glasses 1, Glasses 2
- Mountain icon and shell icon by Freepik, Flaticon Basic License
- City icon from Odinicons, CC 3.0 BY
- Images from Unsplash.com
Ah stop it now, just stop it!!! Your awesomeness is too much for me! Splendid as always, keep on keeping on.
awesome as always
HAHA…What a fun demo. As always, thanks for sharing your creativity and genius.
wow
Wow awesome. But I can’t “download source” 🙁
Thank you! We’ve fixed now.
Awesome demo! This is the first time that I actually understand the code.
Love it.
“Be cool”
?
That question mark above was the Happy face emoji 🙂