Skip to content

Commit

Permalink
feat(core): new page transitions in MD theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Sep 26, 2022
1 parent fae5446 commit b050a88
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
46 changes: 36 additions & 10 deletions src/core/components/page/page-md.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.md {
.page-previous {
transform: translate3d(0, -32px, 0);
}
.page-next {
opacity: 0;
pointer-events: none;
transform: translate3d(0, 56px, 0);
transform: translate3d(0, 128px, 0);
&.page-next-on-right {
.ltr({
transform: translate3d(100%, 0, 0);
Expand All @@ -15,38 +17,62 @@
// Animations
.router-transition-forward {
.page-next {
animation: md-page-next-to-current var(--f7-page-transition-duration) forwards;
animation: md-page-next-to-current var(--f7-page-transition-duration) forwards
cubic-bezier(0, 0.8, 0.3, 1);
}
.page-current {
animation: none;
animation: md-page-current-to-previous var(--f7-page-transition-duration) forwards
cubic-bezier(0, 0.8, 0.3, 1);
}
}
.router-transition-backward {
.page-current {
animation: md-page-current-to-next var(--f7-page-transition-duration) forwards;
animation: md-page-current-to-next calc(var(--f7-page-transition-duration) / 4) forwards
cubic-bezier(0.8, 0, 1, 0.3),
md-page-current-to-next-opacity 0ms calc(var(--f7-page-transition-duration) / 4) forwards;
}
.page-previous {
animation: none;
animation: md-page-previous-to-current var(--f7-page-transition-duration) forwards;
}
}
}
@keyframes md-page-next-to-current {
from {
transform: translate3d(0, 56px, 0);
opacity: 0;
transform: translate3d(0, 128px, 0);
}
to {
transform: translate3d(0, 0px, 0);
opacity: 1;
}
}
@keyframes md-page-current-to-next {
from {
transform: translate3d(0, 0, 0);
}
to {
transform: translate3d(0, 128px, 0);
}
}
@keyframes md-page-current-to-next-opacity {
from {
opacity: 1;
}
to {
transform: translate3d(0, 56px, 0);
opacity: 0;
}
}
@keyframes md-page-current-to-previous {
from {
transform: translate3d(0, 0, 0);
}
to {
transform: translate3d(0, -32px, 0);
}
}
@keyframes md-page-previous-to-current {
from {
transform: translate3d(0, -32px, 0);
}
to {
transform: translate3d(0, 0px, 0);
}
}
2 changes: 1 addition & 1 deletion src/core/components/page/page-vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

});
.md-vars({
--f7-page-transition-duration: 250ms;
--f7-page-transition-duration: 400ms;
--f7-page-title-font-size: 34px;
--f7-page-title-font-weight: 500;
--f7-page-title-letter-spacing: 0;
Expand Down
3 changes: 2 additions & 1 deletion src/core/modules/router/router-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ class Router extends Framework7Class {
if (callback) callback();
}

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

Expand Down

0 comments on commit b050a88

Please sign in to comment.