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
}

View File

@ -44,7 +44,7 @@ Item {
source: opacity > 0 ? "../Base/HBusyIndicator.qml" : ""
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.fillHeight: true
Behavior on opacity { HOpacityAnimator {} }
Behavior on opacity { HNumberAnimation {} }
}
HButton {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -89,6 +89,6 @@ ApplicationWindow {
scale: py.ready ? 1 : 0.5
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 } }
}
}