summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2023-02-16 23:18:12 -0500
committerLoren Burkholder <computersemiexpert@outlook.com>2023-02-20 16:35:00 -0500
commitc9e3ad185021b4ac1849e4fd2c2908808260cae7 (patch)
tree800e9222b0b21abe119dd899b70015a3c7346d2f /resources/qml
parentBlurhash images when the privacy screen is active (diff)
downloadnheko-c9e3ad185021b4ac1849e4fd2c2908808260cae7.tar.xz
Animate transition to blurhash
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/delegates/ImageMessage.qml44
1 files changed, 44 insertions, 0 deletions
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index bb22d0ee..1e2674ae 100644
--- a/resources/qml/delegates/ImageMessage.qml
+++ b/resources/qml/delegates/ImageMessage.qml
@@ -66,6 +66,50 @@ AbstractButton {
         fillMode: Image.PreserveAspectFit
         sourceSize.width: parent.width * Screen.devicePixelRatio
         sourceSize.height: parent.height * Screen.devicePixelRatio
+        state: img.status != Image.Ready ? "Visible" : (timeline.privacyScreen.active ? "Visible" : "Invisible")
+
+        states: [
+            State {
+                name: "Visible"
+
+                PropertyChanges {
+                    target: blurhash_
+                    opacity: 1
+                }
+            },
+            State {
+                name: "Invisible"
+
+                PropertyChanges {
+                    target: blurhash_
+                    opacity: 0
+                }
+            }
+        ]
+        transitions: [
+            Transition {
+                from: "Visible"
+                to: "Invisible"
+
+                NumberAnimation {
+                    target: blurhash_
+                    property: "opacity"
+                    duration: 250
+                    easing.type: Easing.InQuad
+                }
+            },
+            Transition {
+                from: "Invisible"
+                to: "Visible"
+
+                NumberAnimation {
+                    target: blurhash_
+                    property: "opacity"
+                    duration: 500
+                    easing.type: Easing.InQuad
+                }
+            }
+        ]
     }
 
     onClicked: Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId, originalWidth, proportionalHeight);