Skip to content
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

Merged
merged 64 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
8bdf9ea
Initial commit.
kjellr Mar 16, 2023
e260eda
Remove (probably) unnecessary will -change.
kjellr Mar 17, 2023
32ed656
Rename form field label.
kjellr Mar 17, 2023
3f7fae6
Add comments, refine values.
kjellr Mar 17, 2023
8ee2731
Void the effect if reduce motion is active.
kjellr Mar 17, 2023
43edce0
Remove unnecessary params for animation.
kjellr Mar 17, 2023
bcafdf5
Create smoother shine animation on mouse out.
kjellr Mar 20, 2023
05ffb33
Update mix-blend-mode for shine.
kjellr Mar 20, 2023
9cd626f
Smooth out the mouse-out animation for cards.
kjellr Mar 20, 2023
03264d6
Merge branch 'main' into animation-3d-lift
kjellr Mar 20, 2023
49ffb3a
Remove unnecessary rule.
kjellr Mar 20, 2023
fb3100d
Merge branch 'animation-3d-lift' of https://github.com/Shopify/dawn i…
kjellr Mar 20, 2023
1328bf7
Use (hover: hover) media query
kjellr Mar 21, 2023
34f0517
Simplify selectors, add z-index update.
kjellr Mar 21, 2023
641f6c9
Make cards clickable.
kjellr Mar 21, 2023
49b0715
FIx shine animation.
kjellr Mar 21, 2023
58ec8a9
Prevent clicks with pointer-events: none.
kjellr Mar 21, 2023
849d8c4
Ensure gradient edges don't show.
kjellr Mar 22, 2023
2943f1a
Remove redundant specificity.
kjellr Mar 22, 2023
f712457
Start the shine slightly sooner.
kjellr Mar 22, 2023
00a318c
Merge branch 'main' into animation-3d-lift
kjellr Mar 24, 2023
ca5a433
Extend animations to cards with shapes.
kjellr Mar 24, 2023
1cd8265
Fix transform animation speed.
kjellr Mar 24, 2023
8760470
Merge branch 'main' into animation-3d-lift
kjellr Mar 31, 2023
f4a81ed
Remove browser prefix.
kjellr Mar 31, 2023
f47806f
Use duration variables.
kjellr Mar 31, 2023
ee00203
Change duration extended value.
kjellr Apr 3, 2023
1ce83e7
Use duration variable again.
kjellr Apr 3, 2023
2e53989
Less intense rotation for collage items.
kjellr Apr 3, 2023
094dbac
Remove animation from videos posters.
kjellr Apr 3, 2023
8d3a282
Tidy up the animation on the video play button.
kjellr Apr 3, 2023
4cacd38
Fine-tune the video play button animation.
kjellr Apr 3, 2023
0ecbe07
Remove unnecessary rotation transforms.
kjellr Apr 3, 2023
5605ce6
Merge branch 'main' into animation-3d-lift
kjellr Apr 3, 2023
5319a01
Add sparkles.
kjellr Apr 4, 2023
fea67c1
Update 14 translation files
translation-platform[bot] Apr 4, 2023
bb97c0f
Update locales/en.default.schema.json
kjellr Apr 5, 2023
d84c0fb
Merge branch 'animation-3d-lift' of https://github.com/Shopify/dawn i…
kjellr Apr 5, 2023
b5c900a
Don't apply to link-text.
kjellr Apr 5, 2023
d0407ca
Remove the animation from buttons that don't need it.
kjellr Apr 5, 2023
eb1215b
Only target enabled buttons.
kjellr Apr 5, 2023
e60a0c4
Cover special cases where we don't want the button to appear.
kjellr Apr 5, 2023
702e15d
Tidy up sparkles.
kjellr Apr 5, 2023
6ac38ca
Update 5 translation files
translation-platform[bot] Apr 5, 2023
e193a3f
Update 1 translation file
translation-platform[bot] Apr 6, 2023
4875a60
Don't target buttons that are links.
kjellr Apr 6, 2023
034beba
Merge branch 'main' into animation-3d-lift
kjellr Apr 6, 2023
4915de7
Adjust sparkle tactic.
kjellr Apr 7, 2023
23e8c1f
Update behavior when shadows are present.
kjellr Apr 10, 2023
386c6ef
Merge branch 'main' into animation-3d-lift
kjellr Apr 10, 2023
efadcac
Fix appearance for card shapes hovers..
kjellr Apr 10, 2023
c05a815
Fix more button special cases.
kjellr Apr 10, 2023
f119857
Simplify button selectors.
kjellr Apr 10, 2023
4e2c463
Remove broken dynamic payment button styles.
kjellr Apr 10, 2023
c6d7c12
Get the right selectors in place.
kjellr Apr 11, 2023
b145b5b
Update 12 translation files
translation-platform[bot] Apr 11, 2023
517fc1d
Merge branch 'main' into animation-3d-lift
kjellr Apr 11, 2023
80b0fda
Update 7 translation files
translation-platform[bot] Apr 12, 2023
27220aa
Update 1 translation file
translation-platform[bot] Apr 13, 2023
213d923
Merge branch 'main' into animation-3d-lift
kjellr Apr 14, 2023
9ce7141
Merge branch 'main' into animation-3d-lift
ludoboludo Apr 19, 2023
8055eb1
Merge branch 'main' into animation-3d-lift
ludoboludo Apr 21, 2023
80619c7
Don't apply to tertiary buttons.
kjellr Apr 25, 2023
168f94d
Merge branch 'main' into animation-3d-lift
kjellr Apr 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ details > * {
--duration-default: 200ms;
--duration-long: 500ms;
--duration-extra-long: 600ms;
--duration-extended: 3s;
--animation-slide-in: slideIn var(--duration-extra-long) cubic-bezier(0, 0, 0.3, 1) forwards;
}

Expand Down Expand Up @@ -3311,3 +3312,110 @@ details-disclosure > details {
}
}
}

/* Element Hovers: 3d Lift */

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
.animate--hover-3d-lift .card-wrapper .card--card,
.animate--hover-3d-lift .card-wrapper .card--standard .card__inner,
.animate--hover-3d-lift .button:not(.button--tertiary),
.animate--hover-3d-lift .shopify-challenge__button,
.animate--hover-3d-lift .customer button,
.animate--hover-3d-lift .shopify-payment-button__button,
.animate--hover-3d-lift .deferred-media__poster-button {
transition: transform var(--duration-long) ease, box-shadow var(--duration-long) ease;
transform-origin: center;
z-index: 1;
}

.animate--hover-3d-lift .card-wrapper:hover .card--card,
.animate--hover-3d-lift .card-wrapper:hover .card--standard .card__inner,
.animate--hover-3d-lift .button:not(.button--tertiary):not([disabled]):hover,
.animate--hover-3d-lift .shopify-challenge__button:not([disabled]):hover,
.animate--hover-3d-lift .customer button:not([disabled]):hover,
.animate--hover-3d-lift .shopify-payment-button__button:hover,
.animate--hover-3d-lift .deferred-media__poster-button:hover {
transition: transform var(--duration-extended) ease, box-shadow var(--duration-long) ease; /* Slow the card transition speed while hover is active. */
transform: rotate(1deg);
box-shadow:
-1rem -1rem 1rem -1rem rgba(0, 0, 0, 0.05),
1rem 1rem 1rem -1rem rgba(0, 0, 0, 0.05),
0 0 0.5rem 0 rgba(255,255,255,0),
0 2rem 3.5rem -2rem rgba(0, 0, 0, 0.5);
}

.animate--hover-3d-lift .video-section__poster:hover .deferred-media__poster-button {
transform: translate(-50%,-50%) scale(1.05); /* Apply a specialized transform to the video play button. */
}

.animate--hover-3d-lift .collage__item .card-wrapper:hover .card--card,
.animate--hover-3d-lift .collage__item .card-wrapper:hover .card--standard .card__inner {
transform: rotate(0.5deg); /* Less intense rotation for collage items. */
}

.animate--hover-3d-lift .card-wrapper .card--shape.card--standard:not(.card--text) .card__inner {
box-shadow: none;
transition: transform var(--duration-long) ease, filter var(--duration-long) ease;
}

.animate--hover-3d-lift .card-wrapper:hover .card--shape.card--standard:not(.card--text) .card__inner {
transition: transform calc(2 * var(--duration-extended)) ease, filter var(--duration-long) ease; /* Slow the card transition speed while hover is active. */
filter: drop-shadow(0rem 2rem 2rem rgba(0, 0, 0, 0.15))
drop-shadow(0rem 1rem 1rem rgba(0, 0, 0, 0.15));
}

.animate--hover-3d-lift .card-wrapper:hover .card--card:after,
.animate--hover-3d-lift .card-wrapper:hover .card--standard .card__inner:after,
.animate--hover-3d-lift .card-wrapper:hover .card--shape.card--standard:not(.card--text) .card__inner .card__media:before {
background-image: var(--easter-egg);
background-size: 250px 250px;
mix-blend-mode: color-dodge;
pointer-events: none;
z-index: 2;
}
Copy link
Contributor

@stufreen stufreen Apr 10, 2023

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

Copy link
Contributor Author

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.


.animate--hover-3d-lift .card-wrapper:hover .card--shape.card--standard:not(.card--text) .card__inner .card__media:before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}

.animate--hover-3d-lift .card-wrapper .card--card:before,
.animate--hover-3d-lift .card-wrapper .card--standard .card__media:after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0;
pointer-events: none;
transition: background-position calc(2 * var(--duration-extended)) ease, opacity var(--duration-default) ease;
mix-blend-mode: overlay;
background-size: 400% 100%;
background-position: 90% 0;
background-repeat: no-repeat;
background-image: linear-gradient(
135deg,
rgba(255,255,255,0) 45%,
rgba(255,255,255,1) 50%,
rgba(255,255,255,0) 55%
);
}

.animate--hover-3d-lift .card-wrapper:hover .card--card:before,
.animate--hover-3d-lift .card-wrapper:hover .card--standard .card__media:after {
opacity: 0.2;
transition: background-position 6s ease, opacity var(--duration-long) ease;
background-position: left;
z-index: 2;
}

:root {
--easter-egg: none;
--sparkle: url('./sparkle.gif');
}
}
Binary file added assets/sparkle.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions config/settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,23 @@
"id": "animations_reveal_on_scroll",
"label": "t:settings_schema.animations.settings.animations_reveal_on_scroll.label",
"default": true
},
{
"type": "select",
"id": "animations_hover_elements",
"options": [
{
"value": "default",
"label": "t:settings_schema.animations.settings.animations_hover_elements.options__1.label"
},
{
"value": "3d-lift",
"label": "t:settings_schema.animations.settings.animations_hover_elements.options__2.label"
}
],
"default": "default",
"label": "t:settings_schema.animations.settings.animations_hover_elements.label",
"info": "t:settings_schema.animations.settings.animations_hover_elements.info"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion layout/theme.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
</script>
</head>

<body class="gradient">
<body class="gradient{% if settings.animations_hover_elements != 'none' %} animate--hover-{{ settings.animations_hover_elements }}{% endif %}">
<a class="skip-to-content-link button visually-hidden" href="#MainContent">
{{ 'accessibility.skip_to_text' | t }}
</a>
Expand Down
10 changes: 10 additions & 0 deletions locales/cs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Zobrazit sekce při skrolování"
},
"animations_hover_elements": {
"options__1": {
"label": "Žádný"
},
"options__2": {
"label": "3D vysunutí"
},
"label": "Efekt najetí",
"info": "Ovlivňuje karty a tlačítka."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/da.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Afslør afsnit ved rulning"
},
"animations_hover_elements": {
"options__1": {
"label": "Ingen"
},
"options__2": {
"label": "3D-løft"
},
"label": "Svæveeffekt",
"info": "Påvirker kort og knapper."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/de.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Beim Scrollen Abschnitte einblenden"
},
"animations_hover_elements": {
"options__1": {
"label": "Keiner"
},
"options__2": {
"label": "3D-Lift"
},
"label": "Hover-Effekt",
"info": "Wirkt sich auf Karten und Schaltflächen aus."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/en.default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Reveal sections on scroll"
},
"animations_hover_elements": {
"options__1": {
"label": "None"
},
"options__2": {
"label": "3D lift"
},
"label": "Hover effect",
"info": "Affects cards and buttons."
}
}
},
Expand Down
10 changes: 10 additions & 0 deletions locales/es.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Revelar secciones al desplazarse"
},
"animations_hover_elements": {
"options__1": {
"label": "Ninguna"
},
"options__2": {
"label": "3D Lift"
},
"label": "Efecto hover",
"info": "Afecta a tarjetas y botones."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/fi.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Näytä osiot vierittämällä"
},
"animations_hover_elements": {
"options__1": {
"label": "Ei mitään"
},
"options__2": {
"label": "3D-nosto"
},
"label": "Osoitusefekti",
"info": "Vaikuttaa kortteihin ja painikkeisiin."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/fr.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Afficher les sections lors du défilement"
},
"animations_hover_elements": {
"options__1": {
"label": "Aucun"
},
"options__2": {
"label": "3D lift"
},
"label": "Effet de survol",
"info": "Concerne les cartes et les boutons."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/it.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Mostra sezioni durante lo scorrimento"
},
"animations_hover_elements": {
"options__1": {
"label": "Nessuno"
},
"options__2": {
"label": "3D lift"
},
"label": "Effetto hover",
"info": "Riguarda schede e pulsanti."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/ja.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "スクロールでセクションを表示する"
},
"animations_hover_elements": {
"options__1": {
"label": "なし"
},
"options__2": {
"label": "3Dリフト"
},
"label": "ホバー効果",
"info": "カードとボタンに影響を与えます。"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/ko.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "스크롤 시 섹션 표시"
},
"animations_hover_elements": {
"options__1": {
"label": "없음"
},
"options__2": {
"label": "3D 리프트"
},
"label": "호버 효과",
"info": "카드 및 버튼에 영향을 미칩니다."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/nb.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Vis melding ved rulling"
},
"animations_hover_elements": {
"options__1": {
"label": "Ingen"
},
"options__2": {
"label": "3D-løft"
},
"label": "Musepekereffekt",
"info": "Påvirker kort og knapper."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/nl.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Secties laten zien bij scrollen"
},
"animations_hover_elements": {
"options__1": {
"label": "Geen"
},
"options__2": {
"label": "3D-lift"
},
"label": "Zweef-effect",
"info": "Wordt gebruikt voor kaarten en knoppen."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/pl.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Pokaż sekcje podczas przewijania"
},
"animations_hover_elements": {
"options__1": {
"label": "Brak"
},
"options__2": {
"label": "Podnoszenie 3D"
},
"label": "Efekt obszaru aktywnego",
"info": "Wpływa na karty i przyciski."
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions locales/pt-BR.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@
"settings": {
"animations_reveal_on_scroll": {
"label": "Revelar seções durante a rolagem"
},
"animations_hover_elements": {
"options__1": {
"label": "Nenhum"
},
"options__2": {
"label": "Elevação 3D"
},
"label": "Efeito ao passar o mouse",
"info": "Afeta cartões e botões."
}
}
}
Expand Down
Loading