animation on close

This commit is contained in:
Marco Martin 2015-06-21 12:26:14 -07:00
parent 536dc945fd
commit 15e4468834
2 changed files with 25 additions and 6 deletions

View file

@ -35,12 +35,23 @@ Item {
fill: parent
margins: units.gridUnit
}
NumberAnimation {
SequentialAnimation {
id: slideAnim
target: background
properties: "x"
duration: units.longDuration
easing.type: Easing.InOutQuad
property alias to: internalSlideAnim.to
NumberAnimation {
id: internalSlideAnim
target: background
properties: "x"
duration: units.longDuration
easing.type: Easing.InOutQuad
}
ScriptAction {
script: {
if (background.x != 0) {
backend.closeByItemId(model.Id);
}
}
}
}
Rectangle {
id: background
@ -79,7 +90,8 @@ Item {
onReleased: {
delegate.z = 0;
if (Math.abs(background.x) > background.width/2) {
backend.closeByItemId(model.Id);
slideAnim.to = background.x > 0 ? background.width*2 : -background.width*2;
slideAnim.running = true;
} else {
slideAnim.to = 0;
slideAnim.running = true;

View file

@ -121,5 +121,12 @@ FullScreenPanel {
height: window.height
}
delegate: Task {}
displaced: Transition {
NumberAnimation {
properties: "x,y"
duration: units.longDuration
easing.type: Easing.InOutQuad
}
}
}
}