fix: reverse post return transition
This commit is contained in:
1 parent
3b4b598ce5
commit
5e9909ac7a
4 files changed
+128
-27
No files matched your search
+87
-22
@@ -1151,89 +1151,154 @@ html.home-view-transition::view-transition-new(root) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(root) {
|
html.home-view-transition.returning-home::view-transition-old(root) {
|
||||||
animation: homeSourceFadeOut 0.24s ease-out both;
|
animation: returnPostSurroundingsOut 0.24s 0.16s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(root) {
|
html.home-view-transition.returning-home::view-transition-new(root) {
|
||||||
animation: homeFeedFadeIn 0.32s ease-out both;
|
animation: returnFeedReveal 0.28s 0.34s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-expand) {
|
html.home-view-transition.returning-home::view-transition-group(post-expand) {
|
||||||
animation-duration: 0.48s;
|
animation-duration: 0.96s;
|
||||||
|
animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
html.home-view-transition.returning-home::view-transition-group(post-sidebar) {
|
||||||
|
animation-duration: 0.72s;
|
||||||
|
animation-delay: 0.24s;
|
||||||
|
animation-fill-mode: both;
|
||||||
|
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
html.home-view-transition.returning-home::view-transition-group(post-heading) {
|
||||||
|
animation-duration: 0.64s;
|
||||||
|
animation-delay: 0.32s;
|
||||||
|
animation-fill-mode: both;
|
||||||
|
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
html.home-view-transition.returning-home::view-transition-group(post-time) {
|
||||||
|
animation-duration: 0.96s;
|
||||||
|
animation-fill-mode: both;
|
||||||
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-sidebar),
|
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-heading),
|
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-time),
|
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-avatar),
|
html.home-view-transition.returning-home::view-transition-group(post-avatar),
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-author),
|
html.home-view-transition.returning-home::view-transition-group(post-author),
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-body),
|
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-pin-state),
|
html.home-view-transition.returning-home::view-transition-group(post-pin-state),
|
||||||
html.home-view-transition.returning-home::view-transition-group(post-edited-state) {
|
html.home-view-transition.returning-home::view-transition-group(post-edited-state) {
|
||||||
animation-duration: 0.48s;
|
animation-duration: 0.68s;
|
||||||
|
animation-delay: 0.28s;
|
||||||
|
animation-fill-mode: both;
|
||||||
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-expand) {
|
html.home-view-transition.returning-home::view-transition-old(post-expand) {
|
||||||
animation: postDetailCollapse 0.24s 0.12s ease-out both;
|
animation: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 1;
|
||||||
|
object-fit: fill;
|
||||||
|
mix-blend-mode: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-expand) {
|
html.home-view-transition.returning-home::view-transition-new(post-expand) {
|
||||||
animation: postCardFadeIn 0.24s 0.18s ease-out both;
|
animation: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
mix-blend-mode: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-heading) {
|
html.home-view-transition.returning-home::view-transition-old(post-heading) {
|
||||||
animation: sharedTitleMorphOut 0.42s ease-out both;
|
animation: returnSharedPartOut 0.24s 0.32s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-heading) {
|
html.home-view-transition.returning-home::view-transition-new(post-heading) {
|
||||||
animation: sharedTitleMorphIn 0.42s ease-out both;
|
animation: returnSharedPartIn 0.24s 0.32s ease-out both;
|
||||||
|
}
|
||||||
|
|
||||||
|
html.home-view-transition.returning-home::view-transition-old(post-time) {
|
||||||
|
animation: returnSharedPartOut 0.2s 0.47s ease-out both;
|
||||||
|
}
|
||||||
|
|
||||||
|
html.home-view-transition.returning-home::view-transition-new(post-time) {
|
||||||
|
animation: returnSharedPartIn 0.2s 0.47s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-time),
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-sidebar) {
|
html.home-view-transition.returning-home::view-transition-old(post-sidebar) {
|
||||||
animation: sharedTimeOut 0.14s 0.24s ease-out both;
|
animation: sharedSidebarIn 0.2s 0.34s ease-out reverse both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-time),
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-sidebar) {
|
html.home-view-transition.returning-home::view-transition-new(post-sidebar) {
|
||||||
animation: sharedTimeIn 0.14s 0.26s ease-out both;
|
animation: sharedSidebarOut 0.2s 0.34s ease-out reverse both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-avatar),
|
html.home-view-transition.returning-home::view-transition-old(post-avatar),
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-author),
|
html.home-view-transition.returning-home::view-transition-old(post-author),
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-pin-state),
|
html.home-view-transition.returning-home::view-transition-old(post-pin-state),
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-edited-state) {
|
html.home-view-transition.returning-home::view-transition-old(post-edited-state) {
|
||||||
animation: sharedPartMorphOut 0.42s ease-out both;
|
animation: returnSharedPartOut 0.22s 0.28s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-avatar),
|
html.home-view-transition.returning-home::view-transition-new(post-avatar),
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-author),
|
html.home-view-transition.returning-home::view-transition-new(post-author),
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-pin-state),
|
html.home-view-transition.returning-home::view-transition-new(post-pin-state),
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-edited-state) {
|
html.home-view-transition.returning-home::view-transition-new(post-edited-state) {
|
||||||
animation: sharedPartMorphIn 0.42s ease-out both;
|
animation: returnSharedPartIn 0.22s 0.28s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-detail-controls),
|
html.home-view-transition.returning-home::view-transition-old(post-detail-controls),
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-detail-signature),
|
html.home-view-transition.returning-home::view-transition-old(post-detail-signature),
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-detail-media) {
|
html.home-view-transition.returning-home::view-transition-old(post-detail-media) {
|
||||||
animation: feedOnlyPartOut 0.18s ease-out both;
|
animation: returnDetailOnlyPartOut 0.22s 0.12s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-feed-actions),
|
html.home-view-transition.returning-home::view-transition-new(post-feed-actions),
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-feed-media) {
|
html.home-view-transition.returning-home::view-transition-new(post-feed-media) {
|
||||||
animation: detailOnlyPartIn 0.18s 0.26s ease-out both;
|
animation: returnFeedOnlyPartIn 0.28s 0.44s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-old(post-body) {
|
html.home-view-transition.returning-home::view-transition-old(post-body) {
|
||||||
animation: bodySourceOut 0.1s 0.35s ease-out both;
|
animation: none;
|
||||||
|
opacity: 1;
|
||||||
object-fit: none;
|
object-fit: none;
|
||||||
object-position: left top;
|
object-position: left top;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.home-view-transition.returning-home::view-transition-new(post-body) {
|
html.home-view-transition.returning-home::view-transition-new(post-body) {
|
||||||
animation: bodyTargetIn 0.1s 0.38s ease-out both;
|
animation: none;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes returnPostSurroundingsOut {
|
||||||
|
from { opacity: 1; }
|
||||||
|
to { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes returnFeedReveal {
|
||||||
|
from { opacity: 0; }
|
||||||
|
to { opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes returnSharedPartOut {
|
||||||
|
from { opacity: 1; }
|
||||||
|
to { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes returnSharedPartIn {
|
||||||
|
from { opacity: 0; }
|
||||||
|
to { opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes returnDetailOnlyPartOut {
|
||||||
|
from { opacity: 1; }
|
||||||
|
to { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes returnFeedOnlyPartIn {
|
||||||
|
from { opacity: 0; }
|
||||||
|
to { opacity: 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes feedViewFadeOut {
|
@keyframes feedViewFadeOut {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ function stageSharedGeometry(transition, {
|
|||||||
moveOffset,
|
moveOffset,
|
||||||
moveEasing = 'cubic-bezier(0.16, 1, 0.3, 1)',
|
moveEasing = 'cubic-bezier(0.16, 1, 0.3, 1)',
|
||||||
resizeEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',
|
resizeEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',
|
||||||
|
reverse = false,
|
||||||
}) {
|
}) {
|
||||||
transition.ready.then(() => {
|
transition.ready.then(() => {
|
||||||
const groupAnimation = document.getAnimations().find(
|
const groupAnimation = document.getAnimations().find(
|
||||||
@@ -68,7 +69,28 @@ function stageSharedGeometry(transition, {
|
|||||||
|
|
||||||
const start = frames[0];
|
const start = frames[0];
|
||||||
const end = frames[frames.length - 1];
|
const end = frames[frames.length - 1];
|
||||||
groupAnimation.effect.setKeyframes([
|
groupAnimation.effect.setKeyframes(reverse ? [
|
||||||
|
{
|
||||||
|
offset: 0,
|
||||||
|
width: start.width,
|
||||||
|
height: start.height,
|
||||||
|
transform: start.transform,
|
||||||
|
easing: resizeEasing,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
offset: 1 - moveOffset,
|
||||||
|
width: start.width,
|
||||||
|
height: end.height,
|
||||||
|
transform: start.transform,
|
||||||
|
easing: moveEasing,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
offset: 1,
|
||||||
|
width: end.width,
|
||||||
|
height: end.height,
|
||||||
|
transform: end.transform,
|
||||||
|
},
|
||||||
|
] : [
|
||||||
{
|
{
|
||||||
offset: 0,
|
offset: 0,
|
||||||
width: start.width,
|
width: start.width,
|
||||||
@@ -284,8 +306,20 @@ export default function AppProvider({ children, cachedName = '' }) {
|
|||||||
if (targetCard) targetCard.style.viewTransitionName = 'post-expand';
|
if (targetCard) targetCard.style.viewTransitionName = 'post-expand';
|
||||||
targetParts = namePostTransitionParts(targetCard);
|
targetParts = namePostTransitionParts(targetCard);
|
||||||
});
|
});
|
||||||
stageSharedGeometry(transition, { name: 'post-expand', duration: 480, moveOffset: 0.72 });
|
stageSharedGeometry(transition, {
|
||||||
stageSharedGeometry(transition, { name: 'post-body', duration: 480, moveOffset: 0.72 });
|
name: 'post-expand',
|
||||||
|
duration: 960,
|
||||||
|
moveOffset: 0.62,
|
||||||
|
moveEasing: 'cubic-bezier(0.42, 0, 0.58, 1)',
|
||||||
|
resizeEasing: 'cubic-bezier(0.42, 0, 0.58, 1)',
|
||||||
|
reverse: true,
|
||||||
|
});
|
||||||
|
stageSharedGeometry(transition, {
|
||||||
|
name: 'post-body',
|
||||||
|
duration: 960,
|
||||||
|
moveOffset: 0.62,
|
||||||
|
reverse: true,
|
||||||
|
});
|
||||||
const clearTargetNames = () => {
|
const clearTargetNames = () => {
|
||||||
if (targetCard) targetCard.style.viewTransitionName = '';
|
if (targetCard) targetCard.style.viewTransitionName = '';
|
||||||
clearPostTransitionParts(targetParts);
|
clearPostTransitionParts(targetParts);
|
||||||
|
|||||||
+2
-1
@@ -17,6 +17,7 @@
|
|||||||
"hot": "Latest replies",
|
"hot": "Latest replies",
|
||||||
"newPost": "New post",
|
"newPost": "New post",
|
||||||
"loading": "Loading...",
|
"loading": "Loading...",
|
||||||
|
"loadFailed": "Load failed: {{msg}}",
|
||||||
"empty": "No posts yet — be the first to publish!",
|
"empty": "No posts yet — be the first to publish!",
|
||||||
"pinned": "Pinned",
|
"pinned": "Pinned",
|
||||||
"deleted": "(edited)",
|
"deleted": "(edited)",
|
||||||
@@ -278,4 +279,4 @@
|
|||||||
"save": "Save"
|
"save": "Save"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -17,6 +17,7 @@
|
|||||||
"hot": "最新回复",
|
"hot": "最新回复",
|
||||||
"newPost": "发布新帖",
|
"newPost": "发布新帖",
|
||||||
"loading": "加载中...",
|
"loading": "加载中...",
|
||||||
|
"loadFailed": "加载失败:{{msg}}",
|
||||||
"empty": "还没有帖子,快来发布第一条吧!",
|
"empty": "还没有帖子,快来发布第一条吧!",
|
||||||
"pinned": "置顶",
|
"pinned": "置顶",
|
||||||
"deleted": "(已编辑)",
|
"deleted": "(已编辑)",
|
||||||
@@ -278,4 +279,4 @@
|
|||||||
"save": "保存"
|
"save": "保存"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user