From c644a125860d83f8dfbec33b11015170e2054fcc Mon Sep 17 00:00:00 2001 From: APTX Date: Mon, 21 Feb 2022 22:49:16 +0900 Subject: [PATCH] Add transition for UI show/hide --- uiplugins/ui_desktop_qml_default/qml/main.qml | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/uiplugins/ui_desktop_qml_default/qml/main.qml b/uiplugins/ui_desktop_qml_default/qml/main.qml index c74f820..22af8a0 100644 --- a/uiplugins/ui_desktop_qml_default/qml/main.qml +++ b/uiplugins/ui_desktop_qml_default/qml/main.qml @@ -246,11 +246,53 @@ Window { anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - visible: controlsVisible + visible: true + opacity: 1 function toggleVisible() { controlsVisible = !controlsVisible; } + + states: [ + State { + name: "invisible" + when: !controlsVisible + PropertyChanges { + target: controls + opacity: 0 + } + } + ] + + transitions: [ + Transition { + to: "invisible" + SequentialAnimation { + NumberAnimation { + property: "opacity" + easing.type: Easing.InOutQuad + duration: 500 + } + ScriptAction { + script: controls.visible = false + } + } + }, + Transition { + from: "invisible" + SequentialAnimation { + ScriptAction { + script: controls.visible = true + } + NumberAnimation { + property: "opacity" + easing.type: Easing.InOutQuad + duration: 500 + } + } + } + + ] } TextWithBackground { -- 2.52.0