diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml
index b9830386..d6e6c6a5 100644
--- a/resources/qml/RoomSettings.qml
+++ b/resources/qml/RoomSettings.qml
@@ -50,12 +50,6 @@ ApplicationWindow {
}
}
- // BusyIndicator {
- // Layout.alignment: Qt.AlignHCenter
- // running: roomSettings.isLoading
- // visible: roomSettings.isLoading
- // }
-
Spinner {
Layout.alignment: Qt.AlignHCenter
visible: roomSettings.isLoading
diff --git a/resources/qml/ui/Spinner.qml b/resources/qml/ui/Spinner.qml
index 29160763..a1a09a6a 100644
--- a/resources/qml/ui/Spinner.qml
+++ b/resources/qml/ui/Spinner.qml
@@ -5,6 +5,8 @@
import QtQuick 2.12
import QtGraphicalEffects 1.12
+import "./animations"
+
Item {
id: spinner
@@ -15,6 +17,8 @@ Item {
readonly property real a: Math.PI / 6
readonly property var colors: ["#c0def5", "#87aade", "white"]
readonly property var anims: [anim1, anim2, anim3, anim4, anim5, anim6]
+ readonly property int pauseDuration: barCount * 150
+ readonly property int glowDuration: 300
height: 40
width: barCount * (height * 0.375)
@@ -70,118 +74,50 @@ Item {
color: "white"
}
- SequentialAnimation {
+ BlinkAnimation {
id: anim1
+ target: rect1
+ pauseDuration: spinner.pauseDuration
+ glowDuration: spinner.glowDuration
loops: Animation.Infinite
-
- NumberAnimation {
- target: rect1
- property: "opacity"
- from: 0
- to: 1
- duration: 300
- }
-
- PauseAnimation {
- duration: spinner.barCount * 150
- }
-
}
- SequentialAnimation {
+ BlinkAnimation {
id: anim2
-
- loops: Animation.Infinite
-
- NumberAnimation {
- target: rect2
- property: "opacity"
- from: 0
- to: 1
- duration: 300
- }
-
- PauseAnimation {
- duration: spinner.barCount * 150
- }
-
+ target: rect2
+ pauseDuration: spinner.pauseDuration
+ glowDuration: spinner.glowDuration
}
- SequentialAnimation {
+ BlinkAnimation {
id: anim3
-
- loops: Animation.Infinite
-
- NumberAnimation {
- target: rect3
- property: "opacity"
- from: 0
- to: 1
- duration: 300
- }
-
- PauseAnimation {
- duration: spinner.barCount * 150
- }
+ target: rect3
+ pauseDuration: spinner.pauseDuration
+ glowDuration: spinner.glowDuration
}
- SequentialAnimation {
+ BlinkAnimation {
id: anim4
-
- loops: Animation.Infinite
-
- NumberAnimation {
- target: rect4
- property: "opacity"
- from: 0
- to: 1
- duration: 300
- }
-
- PauseAnimation {
- duration: spinner.barCount * 150
- }
+ target: rect4
+ pauseDuration: spinner.pauseDuration
+ glowDuration: spinner.glowDuration
}
- SequentialAnimation {
+ BlinkAnimation {
id: anim5
-
- loops: Animation.Infinite
-
- NumberAnimation {
- target: rect5
- property: "opacity"
- from: 0
- to: 1
- duration: 300
- }
-
- PauseAnimation {
- duration: spinner.barCount * 150
- }
-
+ target: rect5
+ pauseDuration: spinner.pauseDuration
+ glowDuration: spinner.glowDuration
}
- SequentialAnimation {
+ BlinkAnimation {
id: anim6
-
- loops: Animation.Infinite
-
- NumberAnimation {
- target: rect6
- property: "opacity"
- from: 0
- to: 1
- duration: 300
- }
-
- PauseAnimation {
- duration: spinner.barCount * 150
- }
-
+ target: rect6
+ pauseDuration: spinner.pauseDuration
+ glowDuration: spinner.glowDuration
}
transform: Matrix4x4 {
diff --git a/resources/qml/ui/animations/BlinkAnimation.qml b/resources/qml/ui/animations/BlinkAnimation.qml
new file mode 100644
index 00000000..377296eb
--- /dev/null
+++ b/resources/qml/ui/animations/BlinkAnimation.qml
@@ -0,0 +1,28 @@
+// SPDX-FileCopyrightText: 2021 Nheko Contributors
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import QtQuick 2.12
+import QtGraphicalEffects 1.12
+
+SequentialAnimation {
+ property alias target: numberAnimation.target
+ property alias glowDuration: numberAnimation.duration
+ property alias pauseDuration: pauseAnimation.duration
+
+ loops: Animation.Infinite
+
+ NumberAnimation {
+ id: numberAnimation
+ property: "opacity"
+ from: 0
+ to: 1
+ // /duration: 300
+ }
+
+ PauseAnimation {
+ id: pauseAnimation
+ // duration: spinner.barCount * 150
+ }
+
+}
\ No newline at end of file
diff --git a/resources/qml/ui/animations/qmldir b/resources/qml/ui/animations/qmldir
new file mode 100644
index 00000000..14f9ad86
--- /dev/null
+++ b/resources/qml/ui/animations/qmldir
@@ -0,0 +1,2 @@
+module im.nheko.UI.Animations
+BlinkAnimation 1.0 BlinkAnimation.qml
diff --git a/resources/qml/ui/qmldir b/resources/qml/ui/qmldir
index a8466a10..831a723d 100644
--- a/resources/qml/ui/qmldir
+++ b/resources/qml/ui/qmldir
@@ -1,2 +1,3 @@
module im.nheko.UI
-Ripple 1.0 Ripple.qml
\ No newline at end of file
+Ripple 1.0 Ripple.qml
+Spinner 1.0 Spinner.qml
\ No newline at end of file
diff --git a/resources/res.qrc b/resources/res.qrc
index 913de9d5..9bb8ae2e 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -172,6 +172,7 @@
qml/dialogs/InputDialog.qml
qml/ui/Ripple.qml
qml/ui/Spinner.qml
+ qml/ui/animations/BlinkAnimation.qml
qml/voip/ActiveCallBar.qml
qml/voip/CallDevices.qml
qml/voip/CallInvite.qml