-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cards and Buttons] 3D "Lift" effect on hover #2452
Conversation
The z-index change is required to make sure the hover shadow is visible when a button is inside of a container that has overflow:hidden set.
b5998ba
to
f712457
Compare
I pushed some changes to improve the way this works when cards have an existing dropshadow. Now it no longer replaces the dropshadow, but appears in addition. Since we're retaining the original shadow, this will work better for themes like Crave, which use a solid dropshadow around their cards. ExamplesSolid shadow exampleshadows.mp4Diffused shadow exampleshadow-02.mp4 |
mix-blend-mode: color-dodge; | ||
pointer-events: none; | ||
z-index: 2; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't want to use the easter egg CSS variable you could also just add new CSS rules and the merchant can unlock them by editing the setting value with the text editor. This won't take them off the upgrade path. As far as I know we don't validate the setting values, so you could set it to something like sparkle
in the text editor even if that's not an option in the online store editor.
Screen.Recording.2023-04-10.at.11.42.09.AM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! I think that could be a fun way to do it. My main hesitation is that the sparkles are currently in addition to the rest of the 3d lift rules — I'd need to add a lot of duplicate rules in to target both .animate--hover-3d-lift
and .animate--sparkle
. The selectors are already getting a little heavy, so I'm hesitant to duplicate them all.
This one doesn't look like a straightforward fix. It's enough of a minor one that I think we can punt it to a followup PR.
I think in this case, the only one that doesn't have the hover effect is the image — I think that's fine because it's not clickable anyway. Let me know if I'm misinterpreting something though! Coming back to my note up here, I pushed some changes to simplify the way I was targeting buttons. This should now cover (almost?) all of the buttons that should animate, without requiring all the |
Still looks good to me. I tested the Sparkles and seems to be working as expected. |
For Collage, totally aligned! I found just 2 outsiders only!
|
Great catch, @melissaperreault! Should be fixed now, and ready for another review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! Everything looks good! Thank you for all the hard work! 🚢 🚢 🚢
🙌 Thank you all! |
* Initial commit. * Remove (probably) unnecessary will -change. * Rename form field label. * Add comments, refine values. * Void the effect if reduce motion is active. * Remove unnecessary params for animation. * Create smoother shine animation on mouse out. * Update mix-blend-mode for shine. * Smooth out the mouse-out animation for cards. * Remove unnecessary rule. * Use (hover: hover) media query * Simplify selectors, add z-index update. The z-index change is required to make sure the hover shadow is visible when a button is inside of a container that has overflow:hidden set. * Make cards clickable. * FIx shine animation. * Prevent clicks with pointer-events: none. * Ensure gradient edges don't show. * Remove redundant specificity. * Start the shine slightly sooner. * Extend animations to cards with shapes. * Fix transform animation speed. * Remove browser prefix. * Use duration variables. * Change duration extended value. * Use duration variable again. * Less intense rotation for collage items. * Remove animation from videos posters. * Tidy up the animation on the video play button. * Fine-tune the video play button animation. * Remove unnecessary rotation transforms. * Add sparkles. * Update 14 translation files * Update locales/en.default.schema.json Co-authored-by: melissaperreault <[email protected]> * Don't apply to link-text. * Remove the animation from buttons that don't need it. * Only target enabled buttons. * Cover special cases where we don't want the button to appear. * Tidy up sparkles. * Update 5 translation files * Update 1 translation file * Don't target buttons that are links. * Adjust sparkle tactic. * Update behavior when shadows are present. * Fix appearance for card shapes hovers.. * Fix more button special cases. * Simplify button selectors. * Remove broken dynamic payment button styles. * Get the right selectors in place. * Update 12 translation files * Update 7 translation files * Update 1 translation file * Don't apply to tertiary buttons. --------- Co-authored-by: translation-platform[bot] <34770790+translation-platform[bot]@users.noreply.github.com> Co-authored-by: melissaperreault <[email protected]> Co-authored-by: Ludo <[email protected]>
PR Summary:
This PR adds an optional "3D Lift" to Cards and Buttons wherein the element appears to lift off the page on hover. The element also receives a subtle shine effect while it's lifted up off the page.
20-19-iun43-vh4a2.mp4
Why are these changes introduced?
Closes #2451.
What approach did you take?
The animations are just a couple CSS transitions:
body
.Other considerations
Since the effect is purely aesthetic, it becomes inactive when the visitor has
prefers-reduced-motion
active.Known bugs:
Visual impact on existing themes
This feature is optional, and off by default. When merchants activate it by selecting it from the dropdown in Theme Settings, buttons and product cards across their storefront will receive this new hover effect.
Testing steps/scenarios
Demo links
Checklist