Improve pageLoader animation

This commit is contained in:
miruka 2020-09-03 10:49:15 -04:00
parent 3f339b7bb9
commit f5c6a2627b
3 changed files with 22 additions and 5 deletions

View File

@ -14,6 +14,7 @@ HDrawer {
property int buttonWidth: property int buttonWidth:
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0 buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
readonly property alias contentTranslation: contentTranslation
readonly property alias buttonRepeater: buttonRepeater readonly property alias buttonRepeater: buttonRepeater
readonly property alias swipeView: swipeView readonly property alias swipeView: swipeView
@ -23,6 +24,7 @@ HDrawer {
HColumnLayout { HColumnLayout {
anchors.fill: parent anchors.fill: parent
transform: Translate { id: contentTranslation }
Rectangle { Rectangle {
color: buttonsBackgroundColor color: buttonsBackgroundColor

View File

@ -67,8 +67,8 @@ HLoader {
clip: appearAnimation.running clip: appearAnimation.running
onLoaded: { takeFocus(); appearAnimation.start() } onLoaded: { takeFocus(); appearAnimation.restart() }
onRecycled: appearAnimation.start() onRecycled: appearAnimation.restart()
Component.onCompleted: { Component.onCompleted: {
if (! py.startupAnyAccountsSaved) { if (! py.startupAnyAccountsSaved) {
@ -92,10 +92,10 @@ HLoader {
id: appearAnimation id: appearAnimation
target: pageLoader.item target: pageLoader.item
property: "x" property: "x"
from: -300 from: -pageLoader.width
to: 0 to: 0
easing.type: Easing.OutBack easing.type: Easing.OutCirc
duration: theme.animationDuration * 1.5 factor: 2
} }
HShortcut { HShortcut {

View File

@ -39,6 +39,7 @@ Item {
} }
onPageIdentityChanged: if (roomPane) roomPane.appearAnimation.restart()
onFocusChanged: if (focus && loader.item) loader.item.composer.takeFocus() onFocusChanged: if (focus && loader.item) loader.item.composer.takeFocus()
onReadyChanged: longLoading = false onReadyChanged: longLoading = false
@ -110,8 +111,22 @@ Item {
sourceComponent: RoomPane { sourceComponent: RoomPane {
id: roomPane id: roomPane
readonly property alias appearAnimation: appearAnimation
referenceSizeParent: chat referenceSizeParent: chat
maximumSize: chat.width - theme.minimumSupportedWidth * 1.5 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
}
} }
} }
} }