Skip to content

Commit cc4bad4

Browse files
committed
feat(pro-dialogs): slide-over animation between carousel slides
Replaces the cross-fade-only transition between feature carousel slides with a slide-and-fade. Each slide lives at one of three transform positions (translateX(100%) default, 0 when active, -100% when .is-left) so the outgoing slide can animate left while the incoming one comes in from the right (and vice versa for backward navigation). The .is-active rule is defined after .is-left so a slide flipping from parked-left to active animates directly from -100% to 0, no intermediate jump. Same treatment is applied to .feature-info-slide so the text block below the video animates in lockstep with the stage.
1 parent 251409d commit cc4bad4

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

src/styles/phoenix-pro.less

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,31 @@
8585
background: #1b1b1b;
8686
}
8787

88+
/* Slide-over animation: every slide is positioned absolute and lives
89+
at one of three transforms — off-screen right (default), active (0),
90+
or off-screen left (.is-left). JS toggles is-active / is-left so the
91+
transitioning slides cross-fade and translate at the same time, in
92+
the direction matching the user's nav. */
8893
.feature-slide {
8994
position: absolute;
9095
inset: 0;
9196
opacity: 0;
9297
pointer-events: none;
93-
transition: opacity 0.35s ease;
98+
transform: translateX(100%);
99+
transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
100+
will-change: transform, opacity;
94101
}
95102

103+
.feature-slide.is-left {
104+
transform: translateX(-100%);
105+
}
106+
107+
/* Defined after .is-left so a slide flipping from is-left to is-active
108+
animates straight from -100% to 0, no intermediate jump to +100%. */
96109
.feature-slide.is-active {
97110
opacity: 1;
98111
pointer-events: auto;
112+
transform: translateX(0);
99113
}
100114

101115
.feature-thumb {
@@ -228,21 +242,30 @@
228242
}
229243
}
230244

245+
/* Mirror the .feature-slide transform/cross-fade so the text below the
246+
video animates in the same direction as the video stage. */
231247
.feature-info-slide {
232248
position: absolute;
233249
inset: 0;
234250
padding: 10px 28px;
235251
opacity: 0;
236252
pointer-events: none;
237-
transition: opacity 0.35s ease;
253+
transform: translateX(100%);
254+
transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
255+
will-change: transform, opacity;
238256
font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
239257
-webkit-font-smoothing: antialiased;
240258
-moz-osx-font-smoothing: grayscale;
241259
}
242260

261+
.feature-info-slide.is-left {
262+
transform: translateX(-100%);
263+
}
264+
243265
.feature-info-slide.is-active {
244266
opacity: 1;
245267
pointer-events: auto;
268+
transform: translateX(0);
246269
}
247270

248271
.feature-info-slide h2 {

0 commit comments

Comments
 (0)