Animate button loading

This commit is contained in:
miruka 2019-08-27 14:11:33 -04:00
parent f5e52aed4e
commit bf3847dd66
3 changed files with 56 additions and 0 deletions

View File

@ -34,6 +34,7 @@
- Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb` - Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb`
- UI - UI
- Disable buttons when loading, disable edit profile when account loading
- Make invite icon blink if there's no one but ourself in the room, - Make invite icon blink if there's no one but ourself in the room,
but never do it again once the user hovered it long enough to show tooltip but never do it again once the user hovered it long enough to show tooltip
or clicked on it once or clicked on it once

View File

@ -25,6 +25,54 @@ HRowLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
HNumberAnimation {
id: blink
target: icon
property: "opacity"
from: 1
to: 0.3
factor: 2
running: button.loading || false
onStopped: { [from, to] = [to, from]; start() }
}
HNumberAnimation {
target: icon
property: "scale"
from: 1
to: 0.92
factor: blink.factor
running: blink.running
onStopped: { [from, to] = [to, from]; start() }
}
SequentialAnimation {
running: blink.running
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
}
}
} }
HLabel { HLabel {

View File

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