Skip to content

Commit b050a88

Browse files
committed
feat(core): new page transitions in MD theme
1 parent fae5446 commit b050a88

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

src/core/components/page/page-md.less

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
.md {
2+
.page-previous {
3+
transform: translate3d(0, -32px, 0);
4+
}
25
.page-next {
3-
opacity: 0;
46
pointer-events: none;
5-
transform: translate3d(0, 56px, 0);
7+
transform: translate3d(0, 128px, 0);
68
&.page-next-on-right {
79
.ltr({
810
transform: translate3d(100%, 0, 0);
@@ -15,38 +17,62 @@
1517
// Animations
1618
.router-transition-forward {
1719
.page-next {
18-
animation: md-page-next-to-current var(--f7-page-transition-duration) forwards;
20+
animation: md-page-next-to-current var(--f7-page-transition-duration) forwards
21+
cubic-bezier(0, 0.8, 0.3, 1);
1922
}
2023
.page-current {
21-
animation: none;
24+
animation: md-page-current-to-previous var(--f7-page-transition-duration) forwards
25+
cubic-bezier(0, 0.8, 0.3, 1);
2226
}
2327
}
2428
.router-transition-backward {
2529
.page-current {
26-
animation: md-page-current-to-next var(--f7-page-transition-duration) forwards;
30+
animation: md-page-current-to-next calc(var(--f7-page-transition-duration) / 4) forwards
31+
cubic-bezier(0.8, 0, 1, 0.3),
32+
md-page-current-to-next-opacity 0ms calc(var(--f7-page-transition-duration) / 4) forwards;
2733
}
2834
.page-previous {
29-
animation: none;
35+
animation: md-page-previous-to-current var(--f7-page-transition-duration) forwards;
3036
}
3137
}
3238
}
3339
@keyframes md-page-next-to-current {
3440
from {
35-
transform: translate3d(0, 56px, 0);
36-
opacity: 0;
41+
transform: translate3d(0, 128px, 0);
3742
}
3843
to {
3944
transform: translate3d(0, 0px, 0);
40-
opacity: 1;
4145
}
4246
}
4347
@keyframes md-page-current-to-next {
4448
from {
4549
transform: translate3d(0, 0, 0);
50+
}
51+
to {
52+
transform: translate3d(0, 128px, 0);
53+
}
54+
}
55+
@keyframes md-page-current-to-next-opacity {
56+
from {
4657
opacity: 1;
4758
}
4859
to {
49-
transform: translate3d(0, 56px, 0);
5060
opacity: 0;
5161
}
5262
}
63+
@keyframes md-page-current-to-previous {
64+
from {
65+
transform: translate3d(0, 0, 0);
66+
}
67+
to {
68+
transform: translate3d(0, -32px, 0);
69+
}
70+
}
71+
@keyframes md-page-previous-to-current {
72+
from {
73+
transform: translate3d(0, -32px, 0);
74+
}
75+
to {
76+
transform: translate3d(0, 0px, 0);
77+
}
78+
}

src/core/components/page/page-vars.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
});
3535
.md-vars({
36-
--f7-page-transition-duration: 250ms;
36+
--f7-page-transition-duration: 400ms;
3737
--f7-page-title-font-size: 34px;
3838
--f7-page-title-font-weight: 500;
3939
--f7-page-title-letter-spacing: 0;

src/core/modules/router/router-class.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ class Router extends Framework7Class {
362362
if (callback) callback();
363363
}
364364

365-
(direction === 'forward' ? $newPageEl : $oldPageEl).animationEnd(() => {
365+
// eslint-disable-next-line
366+
(direction === 'forward' ? $newPageEl : ios ? $oldPageEl : $newPageEl).animationEnd(() => {
366367
onDone();
367368
});
368369

0 commit comments

Comments
 (0)