Work some more on the transition

This still doesn't work.
This commit is contained in:
Loren Burkholder 2021-04-02 13:42:26 -04:00
parent a15b5d3fdb
commit 31ea6413c6

View file

@ -13,17 +13,134 @@ Item {
function show(attachment, messageModel) { function show(attachment, messageModel) {
attached = attachment attached = attachment
model = messageModel model = messageModel
visible = true state = "shown"
popup.state = "shown"
} }
function hide() { function hide() {
popup.state = "hidden" state = "hidden"
visible = false
attached = undefined attached = undefined
model = undefined model = undefined
} }
// TODO: make this work
states: [
State {
name: "hidden"
PropertyChanges {
target: popupRoot
visible: false
}
PropertyChanges {
target: popup
y: timelineRoot.height + 1 // hidden
visible: false
}
PropertyChanges {
target: overlay
visible: false
}
},
State {
name: "shown"
PropertyChanges {
target: popupRoot
visible: true
}
PropertyChanges {
target: popup
y: timelineRoot.height - popup.height
visible: true
}
PropertyChanges {
target: overlay
visible: true
}
}
]
state: "hidden"
transitions: [
Transition {
from: "hidden"
to: "shown"
SequentialAnimation {
ParallelAnimation {
NumberAnimation {
target: popupRoot
property: "visible"
duration: 0
}
NumberAnimation {
target: popup
property: "visible"
duration: 0
}
}
ParallelAnimation {
NumberAnimation {
target: popup
property: "y"
duration: 500
easing.type: Easing.InOutQuad
}
NumberAnimation {
target: overlay
property: "visible"
duration: 500
easing.type: Easing.InQuad
}
}
}
},
Transition {
from: "shown"
to: "hidden"
SequentialAnimation {
ParallelAnimation {
NumberAnimation {
target: popup
property: "y"
duration: 500
easing.type: Easing.InOutQuad
}
NumberAnimation {
target: overlay
property: "visible"
duration: 500
easing.type: Easing.InQuad
}
}
ParallelAnimation {
NumberAnimation {
target: popupRoot
property: "visible"
duration: 0
}
NumberAnimation {
target: popup
property: "visible"
duration: 0
}
}
}
}
]
property Item attached: null property Item attached: null
property alias model: row.model property alias model: row.model
@ -38,41 +155,6 @@ Item {
width: parent.width width: parent.width
color: colors.window color: colors.window
// TODO: make this work
states: [
State {
name: "hidden"
PropertyChanges {
target: popup
y: timelineRoot.height + 1 // hidden
visible: false
}
},
State {
name: "shown"
PropertyChanges {
target: popup
y: timelineRoot.height - popup.height
visible: true
}
}
]
state: "hidden"
transitions: Transition {
from: "hidden"
to: "shown"
reversible: true
NumberAnimation {
target: popup
property: y
duration: 5000
easing.type: Easing.InOutQuad
alwaysRunToEnd: true
}
}
RowLayout { RowLayout {
id: row id: row
@ -185,13 +267,13 @@ Item {
TapHandler { TapHandler {
onTapped: popupRoot.hide() onTapped: popupRoot.hide()
} }
}
// TODO: this needs some love // TODO: this needs some work; it doesn't blur very well
FastBlur { FastBlur {
z: overlay.z - 1 z: overlay.z - 1
anchors.fill: parent anchors.fill: parent
source: timelineRoot source: timelineRoot
radius: 50 radius: 50
} }
}
} }