From 611f8193736de08e99d642cfefc8d459213fbff9 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 18 May 2025 02:00:47 +0200 Subject: [PATCH] refractor elementMoveEnter anims --- .../quickshell/modules/common/Appearance.qml | 7 +++++ .../modules/common/widgets/Revealer.qml | 4 +-- .../common/widgets/StyledProgressBar.qml | 6 +--- .../onScreenDisplay/OsdValueIndicator.qml | 12 ++------ .../modules/overview/OverviewWindow.qml | 30 ++++--------------- .../quickshell/modules/sidebarLeft/AiChat.qml | 30 +++++++------------ .../quickshell/modules/sidebarLeft/Anime.qml | 24 +++++---------- .../modules/sidebarLeft/anime/BooruImage.qml | 6 +--- 8 files changed, 36 insertions(+), 83 deletions(-) diff --git a/.config/quickshell/modules/common/Appearance.qml b/.config/quickshell/modules/common/Appearance.qml index 4afc866c7..b8fd1028a 100644 --- a/.config/quickshell/modules/common/Appearance.qml +++ b/.config/quickshell/modules/common/Appearance.qml @@ -223,6 +223,13 @@ Singleton { property int type: Easing.BezierSpline property list bezierCurve: animationCurves.emphasizedAccel property int velocity: 650 + property Component numberAnimation: Component { + NumberAnimation { + duration: root.animation.elementMoveExit.duration + easing.type: root.animation.elementMoveExit.type + easing.bezierCurve: root.animation.elementMoveExit.bezierCurve + } + } } property QtObject elementMoveFast: QtObject { property int duration: 200 diff --git a/.config/quickshell/modules/common/widgets/Revealer.qml b/.config/quickshell/modules/common/widgets/Revealer.qml index f919fb9f5..327d4aaa1 100644 --- a/.config/quickshell/modules/common/widgets/Revealer.qml +++ b/.config/quickshell/modules/common/widgets/Revealer.qml @@ -16,10 +16,10 @@ Item { Behavior on implicitWidth { enabled: !vertical - animation: Appearance.animation.elementMoveEnter.numberAnimation + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } Behavior on implicitHeight { enabled: vertical - animation: Appearance.animation.elementMoveEnter.numberAnimation + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } } diff --git a/.config/quickshell/modules/common/widgets/StyledProgressBar.qml b/.config/quickshell/modules/common/widgets/StyledProgressBar.qml index 765f38d10..0a27fca99 100644 --- a/.config/quickshell/modules/common/widgets/StyledProgressBar.qml +++ b/.config/quickshell/modules/common/widgets/StyledProgressBar.qml @@ -15,11 +15,7 @@ ProgressBar { property real valueBarGap: 4 Behavior on value { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } background: Rectangle { diff --git a/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml b/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml index dee30c397..c079f1dad 100644 --- a/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml +++ b/.config/quickshell/modules/onScreenDisplay/OsdValueIndicator.qml @@ -52,18 +52,10 @@ Item { rotation: 180 * (root.rotateIcon ? value : 0) Behavior on iconSize { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } Behavior on rotation { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } } diff --git a/.config/quickshell/modules/overview/OverviewWindow.qml b/.config/quickshell/modules/overview/OverviewWindow.qml index d6526904e..0d6990eaf 100644 --- a/.config/quickshell/modules/overview/OverviewWindow.qml +++ b/.config/quickshell/modules/overview/OverviewWindow.qml @@ -47,32 +47,16 @@ Rectangle { // Window border.width : 1 Behavior on x { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } Behavior on y { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } Behavior on width { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } Behavior on height { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } ColumnLayout { @@ -88,11 +72,7 @@ Rectangle { // Window implicitSize: Math.min(targetWindowWidth, targetWindowHeight) * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio) Behavior on implicitSize { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } IconImage { diff --git a/.config/quickshell/modules/sidebarLeft/AiChat.qml b/.config/quickshell/modules/sidebarLeft/AiChat.qml index 9f05b6a3b..b8df45bb7 100644 --- a/.config/quickshell/modules/sidebarLeft/AiChat.qml +++ b/.config/quickshell/modules/sidebarLeft/AiChat.qml @@ -179,22 +179,18 @@ int main(int argc, char* argv[]) { } add: Transition { - NumberAnimation { - property: "opacity" - from: 0; to: 1 - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animations: [Appearance.animation.elementMoveEnter.numberAnimation.createObject(this, { + property: "opacity", + from: 0, + to: 1 + })] } remove: Transition { - NumberAnimation { - property: "opacity" - from: 1; to: 0 - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animations: [Appearance.animation.elementMoveEnter.numberAnimation.createObject(this, { + property: "opacity", + from: 1, + to: 0 + })] } model: ScriptModel { @@ -214,11 +210,7 @@ int main(int argc, char* argv[]) { anchors.fill: parent Behavior on opacity { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } ColumnLayout { diff --git a/.config/quickshell/modules/sidebarLeft/Anime.qml b/.config/quickshell/modules/sidebarLeft/Anime.qml index 818d236be..a1beca59d 100644 --- a/.config/quickshell/modules/sidebarLeft/Anime.qml +++ b/.config/quickshell/modules/sidebarLeft/Anime.qml @@ -174,13 +174,11 @@ Item { } add: Transition { - NumberAnimation { - property: "opacity" - from: 0; to: 1 - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animations: [Appearance.animation.elementMoveEnter.numberAnimation.createObject(this, { + property: "opacity", + from: 0, + to: 1 + })] } model: ScriptModel { @@ -208,11 +206,7 @@ Item { anchors.fill: parent Behavior on opacity { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } ColumnLayout { @@ -246,11 +240,7 @@ Item { visible: opacity > 0 Behavior on opacity { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } Rectangle { diff --git a/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml b/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml index ca180271f..55e5361db 100644 --- a/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml +++ b/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml @@ -78,11 +78,7 @@ Button { } Behavior on opacity { - NumberAnimation { - duration: Appearance.animation.elementMoveEnter.duration - easing.type: Appearance.animation.elementMoveEnter.type - easing.bezierCurve: Appearance.animation.elementMoveEnter.bezierCurve - } + animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } }