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 running: true
from: 0 from: 0
to: 1 to: 1

View File

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

View File

@ -16,60 +16,8 @@ HRowLayout {
readonly property alias label: label readonly property alias label: label
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
Item {
id: iconWrapper
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 }
}
HOpacityAnimator {
id: blink
target: iconWrapper
from: 1
to: 0.5
factor: 2
running: button.loading || false
onFinished: {
if (button.loading) { [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 {
id: rotation1
target: iconWrapper
from: 0
to: 180
factor: blink.factor
}
HPauseAnimation { factor: blink.factor * 8 }
HRotationAnimator {
target: rotation1.target
from: rotation1.to
to: 360
factor: rotation1.factor
direction: RotationAnimator.Clockwise
}
}
HIcon { HIcon {
property bool loading: button.loading || false property bool loading: button.loading || false
@ -79,8 +27,52 @@ HRowLayout {
colorize: enabled ? button.icon.color: theme.icons.disabledColorize colorize: enabled ? button.icon.color: theme.icons.disabledColorize
cache: button.icon.cache cache: button.icon.cache
onLoadingChanged: if (! loading) resetAnimations.start()
Layout.fillHeight: true Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
ParallelAnimation {
id: resetAnimations
HNumberAnimation { target: icon; property: "opacity"; to: 1 }
HNumberAnimation { target: icon; property: "rotation"; to: 0 }
}
HNumberAnimation on opacity {
id: blink
from: 1
to: 0.5
factor: 2
running: button.loading || false
onFinished: { [from, to] = [to, from]; start() }
}
SequentialAnimation {
running: button.loading || false
loops: Animation.Infinite
HPauseAnimation { factor: blink.factor * 8 }
HNumberAnimation {
id: rotation1
target: icon
property: "rotation"
from: 0
to: 180
factor: blink.factor
}
HPauseAnimation { factor: blink.factor * 8 }
HNumberAnimation {
target: rotation1.target
property: rotation1.property
from: rotation1.to
to: 360
factor: rotation1.factor
}
} }
} }
@ -93,7 +85,6 @@ HRowLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
} }

View File

@ -37,7 +37,6 @@ CheckBox {
scale: box.checked ? 1 : 0 scale: box.checked ? 1 : 0
// FIXME: HScaleAnimator won't work here?
Behavior on scale { Behavior on scale {
HNumberAnimation { HNumberAnimation {
overshoot: 4 overshoot: 4
@ -88,5 +87,5 @@ CheckBox {
function reset() { checked = defaultChecked } 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 when: bar.indeterminate
} }
RotationAnimator on rotation { HNumberAnimation on rotation {
running: bar.indeterminate running: bar.indeterminate
from: 0 from: 0
to: 360 to: 360

View File

@ -56,7 +56,7 @@ Image {
) )
scale: parent.status === Image.Ready && parent.paused ? 1 : 0 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 margins: theme.spacing
enter: Transition { enter: Transition {
HScaleAnimator { from: 0; to: 1; overshoot: 4 } HNumberAnimation { property: "scale"; from: 0; to: 1; overshoot: 4 }
} }
exit: Transition { exit: Transition {
// FIXME: HScaleAnimator won't work here?
HNumberAnimation { property: "scale"; to: 0 } HNumberAnimation { property: "scale"; to: 0 }
} }

View File

@ -26,7 +26,7 @@ ProgressBar {
Behavior on color { HColorAnimation {} } Behavior on color { HColorAnimation {} }
XAnimator on x { HNumberAnimation on x {
running: bar.indeterminate running: bar.indeterminate
duration: theme.animationDuration * 8 duration: theme.animationDuration * 8
from: 0 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 } function reset() { area.clear(); text = defaultText }
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
TextArea { TextArea {
id: textArea id: textArea
@ -102,7 +102,7 @@ ScrollView {
font.family: parent.font.family font.family: parent.font.family
font.pixelSize: parent.font.pixelSize 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 when: disabledText !== null && ! field.enabled
} }
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
Behavior on color { HColorAnimation {} } Behavior on color { HColorAnimation {} }
Behavior on placeholderTextColor { HColorAnimation {} } Behavior on placeholderTextColor { HColorAnimation {} }
@ -99,6 +99,6 @@ TextField {
font.family: parent.font.family font.family: parent.font.family
font.pixelSize: parent.font.pixelSize 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 { enter: Transition {
HNumberAnimation { property: "opacity"; from: 0.0; to: 1.0 } 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
}

View File

@ -44,7 +44,7 @@ Item {
source: opacity > 0 ? "../Base/HBusyIndicator.qml" : "" source: opacity > 0 ? "../Base/HBusyIndicator.qml" : ""
opacity: ready ? 0 : 1 opacity: ready ? 0 : 1
Behavior on opacity { HOpacityAnimator { factor: 2 } } Behavior on opacity { HNumberAnimation { factor: 2 } }
} }
} }

View File

@ -60,7 +60,7 @@ HColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
} }
HButton { HButton {

View File

@ -102,7 +102,7 @@ Column {
id: eventContent id: eventContent
width: parent.width width: parent.width
Behavior on x { HXAnimator {} } Behavior on x { HNumberAnimation {} }
} }

View File

@ -96,7 +96,7 @@ HMxcImage {
opacity: hover.hovered ? 0 : 1 opacity: hover.hovered ? 0 : 1
visible: opacity > 0 visible: opacity > 0
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
} }
EventImageTextBubble { EventImageTextBubble {
@ -107,6 +107,6 @@ HMxcImage {
opacity: hover.hovered ? 0 : 1 opacity: hover.hovered ? 0 : 1
visible: opacity > 0 visible: opacity > 0
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
} }
} }

View File

@ -20,7 +20,7 @@ HTileDelegate {
! mainPaneList.activateLimiter.running && ! mainPane.hasFocus ! mainPaneList.activateLimiter.running && ! mainPane.hasFocus
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
readonly property bool forceExpand: Boolean(mainPaneList.filter) readonly property bool forceExpand: Boolean(mainPaneList.filter)
@ -71,7 +71,7 @@ HTileDelegate {
Layout.fillHeight: true Layout.fillHeight: true
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
} }
HButton { HButton {
@ -99,7 +99,7 @@ HTileDelegate {
Behavior on angle { HNumberAnimation {} } Behavior on angle { HNumberAnimation {} }
} }
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
} }
contextMenu: HMenu { contextMenu: HMenu {

View File

@ -26,7 +26,7 @@ HDrawer {
} }
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
Binding on visible { Binding on visible {
value: false value: false

View File

@ -53,6 +53,6 @@ HRowLayout {
mainUI.pageLoader.forceActiveFocus() mainUI.pageLoader.forceActiveFocus()
} }
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
} }
} }

View File

@ -18,7 +18,7 @@ HTileDelegate {
! mainPaneList.activateLimiter.running && ! mainPane.hasFocus ! mainPaneList.activateLimiter.running && ! mainPane.hasFocus
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
readonly property bool joined: ! invited && ! parted readonly property bool joined: ! invited && ! parted

View File

@ -81,7 +81,7 @@ HGridLayout {
(! avatar.mxc && overlayHover.hovered) ? 0.8 : 0.7 (! avatar.mxc && overlayHover.hovered) ? 0.8 : 0.7
) )
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
Behavior on color { HColorAnimation {} } Behavior on color { HColorAnimation {} }
HoverHandler { id: overlayHover } HoverHandler { id: overlayHover }

View File

@ -67,7 +67,7 @@ HBox {
opacity: nameField.text ? 0 : 1 opacity: nameField.text ? 0 : 1
visible: opacity > 0 visible: opacity > 0
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HNumberAnimation {} }
} }
} }

View File

@ -20,8 +20,12 @@ Item {
SequentialAnimation { SequentialAnimation {
id: pressAnimation id: pressAnimation
HScaleAnimator { target: mainUI; from: 1.0; to: 0.9 } HNumberAnimation {
HScaleAnimator { target: mainUI; from: 0.9; to: 1.0 } target: mainUI; property: "scale"; from: 1.0; to: 0.9
}
HNumberAnimation {
target: mainUI; property: "scale"; from: 0.9; to: 1.0
}
} }
property bool accountsPresent: property bool accountsPresent:
@ -134,9 +138,10 @@ Item {
} }
XAnimator { HNumberAnimation {
id: appearAnimation id: appearAnimation
target: pageLoader.item target: pageLoader.item
property: "x"
from: -300 from: -300
to: 0 to: 0
easing.type: Easing.OutBack easing.type: Easing.OutBack

View File

@ -89,6 +89,6 @@ ApplicationWindow {
scale: py.ready ? 1 : 0.5 scale: py.ready ? 1 : 0.5
source: py.ready ? (Qt.application.arguments[1] || "UI.qml") : "" source: py.ready ? (Qt.application.arguments[1] || "UI.qml") : ""
Behavior on scale { HScaleAnimator { overshoot: 5; factor: 1.2 } } Behavior on scale { HNumberAnimation { overshoot: 5; factor: 1.2 } }
} }
} }