Animators are buggy crap, drop them

This commit is contained in:
miruka
2019-12-16 04:42:41 -04:00
parent aad317126a
commit b307b596d2
28 changed files with 56 additions and 101 deletions

View File

@@ -32,7 +32,7 @@ Rectangle {
}
HScaleAnimator on scale {
HNumberAnimation on scale {
running: true
from: 0
to: 1

View File

@@ -11,7 +11,7 @@ Rectangle {
property QtObject buttonTheme
Behavior on opacity { HOpacityAnimator {} }
Behavior on opacity { HNumberAnimation {} }
Rectangle {

View File

@@ -16,45 +16,49 @@ HRowLayout {
readonly property alias label: label
Behavior on opacity { HOpacityAnimator {} }
Behavior on opacity { HNumberAnimation {} }
Item {
id: iconWrapper
HIcon {
property bool loading: button.loading || false
id: icon
svgName: button.icon.name
colorize: enabled ? button.icon.color: theme.icons.disabledColorize
cache: button.icon.cache
onLoadingChanged: if (! loading) resetAnimations.start()
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: icon.width
Layout.preferredHeight: icon.height
ParallelAnimation {
id: resetAnimations
HOpacityAnimator { target: iconWrapper; to: 1 }
HRotationAnimator { target: iconWrapper; to: 0 }
HNumberAnimation { target: icon; property: "opacity"; to: 1 }
HNumberAnimation { target: icon; property: "rotation"; to: 0 }
}
HOpacityAnimator {
HNumberAnimation on opacity {
id: blink
target: iconWrapper
from: 1
to: 0.5
factor: 2
running: button.loading || false
onFinished: {
if (button.loading) { [from, to] = [to, from]; start() }
}
onFinished: { [from, to] = [to, from]; start() }
}
SequentialAnimation {
running: button.loading || false
loops: Animation.Infinite
onStopped: resetAnimations.start()
HPauseAnimation { factor: blink.factor * 8 }
// These don't work directly on HIcon, hence why we wrap it in
// an Item. Qt bug? (5.13.1_1)
HRotationAnimator {
HNumberAnimation {
id: rotation1
target: iconWrapper
target: icon
property: "rotation"
from: 0
to: 180
factor: blink.factor
@@ -62,26 +66,14 @@ HRowLayout {
HPauseAnimation { factor: blink.factor * 8 }
HRotationAnimator {
HNumberAnimation {
target: rotation1.target
property: rotation1.property
from: rotation1.to
to: 360
factor: rotation1.factor
direction: RotationAnimator.Clockwise
}
}
HIcon {
property bool loading: button.loading || false
id: icon
svgName: button.icon.name
colorize: enabled ? button.icon.color: theme.icons.disabledColorize
cache: button.icon.cache
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
}
}
HLabel {
@@ -93,7 +85,6 @@ HRowLayout {
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
Layout.fillHeight: true
}

View File

@@ -37,7 +37,6 @@ CheckBox {
scale: box.checked ? 1 : 0
// FIXME: HScaleAnimator won't work here?
Behavior on scale {
HNumberAnimation {
overshoot: 4
@@ -88,5 +87,5 @@ CheckBox {
function reset() { checked = defaultChecked }
Behavior on opacity { HOpacityAnimator { factor: 2 } }
Behavior on opacity { HNumberAnimation { factor: 2 } }
}

View File

@@ -38,7 +38,7 @@ RadialBar {
when: bar.indeterminate
}
RotationAnimator on rotation {
HNumberAnimation on rotation {
running: bar.indeterminate
from: 0
to: 360

View File

@@ -56,7 +56,7 @@ Image {
)
scale: parent.status === Image.Ready && parent.paused ? 1 : 0
Behavior on scale { HScaleAnimator { overshoot: 4 } }
Behavior on scale { HNumberAnimation { overshoot: 4 } }
}
}
}

View File

@@ -1,7 +0,0 @@
import QtQuick 2.12
OpacityAnimator {
duration: theme.animationDuration * factor
property real factor: 1.0
}

View File

@@ -10,11 +10,10 @@ Popup {
margins: theme.spacing
enter: Transition {
HScaleAnimator { from: 0; to: 1; overshoot: 4 }
HNumberAnimation { property: "scale"; from: 0; to: 1; overshoot: 4 }
}
exit: Transition {
// FIXME: HScaleAnimator won't work here?
HNumberAnimation { property: "scale"; to: 0 }
}

View File

@@ -26,7 +26,7 @@ ProgressBar {
Behavior on color { HColorAnimation {} }
XAnimator on x {
HNumberAnimation on x {
running: bar.indeterminate
duration: theme.animationDuration * 8
from: 0

View File

@@ -1,7 +0,0 @@
import QtQuick 2.12
RotationAnimator {
duration: theme.animationDuration * factor
property real factor: 1.0
}

View File

@@ -1,10 +0,0 @@
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
}

View File

@@ -38,7 +38,7 @@ ScrollView {
function reset() { area.clear(); text = defaultText }
Behavior on opacity { HOpacityAnimator {} }
Behavior on opacity { HNumberAnimation {} }
TextArea {
id: textArea
@@ -102,7 +102,7 @@ ScrollView {
font.family: parent.font.family
font.pixelSize: parent.font.pixelSize
Behavior on opacity { HOpacityAnimator {} }
Behavior on opacity { HNumberAnimation {} }
}
}
}

View File

@@ -80,7 +80,7 @@ TextField {
when: disabledText !== null && ! field.enabled
}
Behavior on opacity { HOpacityAnimator {} }
Behavior on opacity { HNumberAnimation {} }
Behavior on color { HColorAnimation {} }
Behavior on placeholderTextColor { HColorAnimation {} }
@@ -99,6 +99,6 @@ TextField {
font.family: parent.font.family
font.pixelSize: parent.font.pixelSize
Behavior on opacity { HOpacityAnimator {} }
Behavior on opacity { HNumberAnimation {} }
}
}

View File

@@ -41,7 +41,6 @@ ToolTip {
}
}
// FIXME: HOpacityAnimator won't work for these?
enter: Transition {
HNumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}

View File

@@ -1,7 +0,0 @@
import QtQuick 2.12
XAnimator {
duration: theme.animationDuration * factor
property real factor: 1.0
}

View File

@@ -1,7 +0,0 @@
import QtQuick 2.12
YAnimator {
duration: theme.animationDuration * factor
property real factor: 1.0
}