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