From f5c6a2627b5119085cf06b777a5b37bde6e778e8 Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 3 Sep 2020 10:49:15 -0400 Subject: [PATCH] Improve pageLoader animation --- src/gui/Base/MultiviewPane.qml | 2 ++ src/gui/PageLoader.qml | 10 +++++----- src/gui/Pages/Chat/Chat.qml | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/gui/Base/MultiviewPane.qml b/src/gui/Base/MultiviewPane.qml index f3905e87..22fffb9a 100644 --- a/src/gui/Base/MultiviewPane.qml +++ b/src/gui/Base/MultiviewPane.qml @@ -14,6 +14,7 @@ HDrawer { property int buttonWidth: buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0 + readonly property alias contentTranslation: contentTranslation readonly property alias buttonRepeater: buttonRepeater readonly property alias swipeView: swipeView @@ -23,6 +24,7 @@ HDrawer { HColumnLayout { anchors.fill: parent + transform: Translate { id: contentTranslation } Rectangle { color: buttonsBackgroundColor diff --git a/src/gui/PageLoader.qml b/src/gui/PageLoader.qml index 127a6009..715c2cfc 100644 --- a/src/gui/PageLoader.qml +++ b/src/gui/PageLoader.qml @@ -67,8 +67,8 @@ HLoader { clip: appearAnimation.running - onLoaded: { takeFocus(); appearAnimation.start() } - onRecycled: appearAnimation.start() + onLoaded: { takeFocus(); appearAnimation.restart() } + onRecycled: appearAnimation.restart() Component.onCompleted: { if (! py.startupAnyAccountsSaved) { @@ -92,10 +92,10 @@ HLoader { id: appearAnimation target: pageLoader.item property: "x" - from: -300 + from: -pageLoader.width to: 0 - easing.type: Easing.OutBack - duration: theme.animationDuration * 1.5 + easing.type: Easing.OutCirc + factor: 2 } HShortcut { diff --git a/src/gui/Pages/Chat/Chat.qml b/src/gui/Pages/Chat/Chat.qml index e2c03449..a9381906 100644 --- a/src/gui/Pages/Chat/Chat.qml +++ b/src/gui/Pages/Chat/Chat.qml @@ -39,6 +39,7 @@ Item { } + onPageIdentityChanged: if (roomPane) roomPane.appearAnimation.restart() onFocusChanged: if (focus && loader.item) loader.item.composer.takeFocus() onReadyChanged: longLoading = false @@ -110,8 +111,22 @@ Item { sourceComponent: RoomPane { id: roomPane + + readonly property alias appearAnimation: appearAnimation + referenceSizeParent: chat maximumSize: chat.width - theme.minimumSupportedWidth * 1.5 + + HNumberAnimation { + id: appearAnimation + target: roomPane.contentTranslation + property: "x" + from: -chat.width + roomPane.width + to: 0 + easing.type: Easing.OutCirc + factor: 2 + running: true + } } } }