diff --git a/src/qml/Base/HBox.qml b/src/qml/Base/HBox.qml index de9941c9..84a86ead 100644 --- a/src/qml/Base/HBox.qml +++ b/src/qml/Base/HBox.qml @@ -41,7 +41,7 @@ Rectangle { } - HNumberAnimation on scale { + HScaleAnimator on scale { running: true from: 0 to: 1 diff --git a/src/qml/Base/HCheckBox.qml b/src/qml/Base/HCheckBox.qml index e6fb3855..eff569f6 100644 --- a/src/qml/Base/HCheckBox.qml +++ b/src/qml/Base/HCheckBox.qml @@ -45,8 +45,9 @@ CheckBox { svgName: "check-mark" colorize: theme.controls.checkBox.checkIconColorize - visible: scale > 0 scale: box.checked ? 1 : 0 + + // FIXME: HScaleAnimator won't work here? Behavior on scale { HNumberAnimation { overshoot: 4 diff --git a/src/qml/Base/HImage.qml b/src/qml/Base/HImage.qml index 546d76c9..1594fd61 100644 --- a/src/qml/Base/HImage.qml +++ b/src/qml/Base/HImage.qml @@ -53,9 +53,8 @@ Image { theme.controls.image.maxPauseIndicatorSize, ) scale: parent.status == Image.Ready && parent.paused ? 1 : 0 - visible: scale > 0 - Behavior on scale { HNumberAnimation { overshoot: 4 } } + Behavior on scale { HScaleAnimator { overshoot: 4 } } } } } diff --git a/src/qml/Base/HPopup.qml b/src/qml/Base/HPopup.qml index 7e2ab299..e2e3dd51 100644 --- a/src/qml/Base/HPopup.qml +++ b/src/qml/Base/HPopup.qml @@ -10,10 +10,11 @@ Popup { enter: Transition { - HNumberAnimation { property: "scale"; from: 0; to: 1; overshoot: 4 } + HScaleAnimator { from: 0; to: 1; overshoot: 4 } } exit: Transition { + // FIXME: HScaleAnimator won't work here? HNumberAnimation { property: "scale"; to: 0 } } diff --git a/src/qml/Base/HScaleAnimator.qml b/src/qml/Base/HScaleAnimator.qml new file mode 100644 index 00000000..659c1f34 --- /dev/null +++ b/src/qml/Base/HScaleAnimator.qml @@ -0,0 +1,10 @@ +import QtQuick 2.12 + +ScaleAnimator { + property real factor: 1.0 + property real overshoot: 1.0 + + duration: theme.animationDuration * Math.max(overshoot / 1.7, 1.0) * factor + easing.type: overshoot > 1 ? Easing.OutBack : Easing.Linear + easing.overshoot: overshoot +} diff --git a/src/qml/Base/HToolTip.qml b/src/qml/Base/HToolTip.qml index d374f559..ee370075 100644 --- a/src/qml/Base/HToolTip.qml +++ b/src/qml/Base/HToolTip.qml @@ -37,6 +37,7 @@ ToolTip { } } + // FIXME: HOpacityAnimator won't work for these? enter: Transition { HNumberAnimation { property: "opacity"; from: 0.0; to: 1.0 } } diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 5ebe5aa5..197ff6fd 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -21,12 +21,8 @@ Item { SequentialAnimation { id: pressAnimation - HNumberAnimation { - target: mainUI; property: "scale"; from: 1.0; to: 0.9 - } - HNumberAnimation { - target: mainUI; property: "scale"; from: 0.9; to: 1.0 - } + HScaleAnimator { target: mainUI; from: 1.0; to: 0.9 } + HScaleAnimator { target: mainUI; from: 0.9; to: 1.0 } } property bool accountsPresent: diff --git a/src/qml/Window.qml b/src/qml/Window.qml index b2311b8c..f7e972e9 100644 --- a/src/qml/Window.qml +++ b/src/qml/Window.qml @@ -52,6 +52,6 @@ ApplicationWindow { scale: py.ready ? 1 : 0.5 source: py.ready ? (Qt.application.arguments[1] || "UI.qml") : "" - Behavior on scale { HNumberAnimation { overshoot: 5; factor: 1.2 } } + Behavior on scale { HScaleAnimator { overshoot: 5; factor: 1.2 } } } }