show a close anim

This commit is contained in:
Marco Martin 2020-08-20 15:53:02 +02:00
parent 96420f5080
commit aabcc0949f

View file

@ -56,8 +56,7 @@ PlasmaCore.ColorScope {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.cancelRequested);
root.cancelRequested();
} }
} }
@ -87,33 +86,51 @@ PlasmaCore.ColorScope {
OpacityAnimator { OpacityAnimator {
target: background target: background
from: 0 from: 0
to: 0.5 to: 0.6
duration: units.longDuration duration: units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
ParallelAnimation {
SequentialAnimation {
id: closeAnim id: closeAnim
ScaleAnimator { property var callback
target: lay function execute(call) {
from: 1 callback = call;
to: 10 closeAnim.restart();
duration: units.longDuration
easing.type: Easing.InOutQuad
} }
OpacityAnimator { ParallelAnimation {
target: lay ScaleAnimator {
from: 1 target: lay
to: 0 from: 1
duration: units.longDuration to: 10
easing.type: Easing.InOutQuad duration: units.longDuration
easing.type: Easing.InOutQuad
}
OpacityAnimator {
target: lay
from: 1
to: 0
duration: units.longDuration
easing.type: Easing.InOutQuad
}
OpacityAnimator {
target: background
from: 0.6
to: 0
duration: units.longDuration
easing.type: Easing.InOutQuad
}
} }
OpacityAnimator { ScriptAction {
target: background script: {
from: 0.5 if (closeAnim.callback) {
to: 0 closeAnim.callback();
duration: units.longDuration }
easing.type: Easing.InOutQuad lay.opacity = 1;
lay.scale = 1;
background.opacity = 0.6;
}
} }
} }
GridLayout { GridLayout {
@ -128,8 +145,7 @@ PlasmaCore.ColorScope {
iconSource: "system-reboot" iconSource: "system-reboot"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart") text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Restart")
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.rebootRequested);
root.rebootRequested();
} }
} }
@ -137,8 +153,7 @@ PlasmaCore.ColorScope {
iconSource: "system-shutdown" iconSource: "system-shutdown"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down") text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down")
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.haltRequested);
root.haltRequested();
} }
} }
@ -149,8 +164,7 @@ PlasmaCore.ColorScope {
iconSource: "dialog-cancel" iconSource: "dialog-cancel"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Cancel") text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Cancel")
onClicked: { onClicked: {
closeAnim.restart(); closeAnim.execute(root.cancelRequested);
root.cancelRequested();
} }
} }
} }