mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
refactor: perf improvement stopping singletons with ref
Also switch to scale+opacity anims with custom curve
This commit is contained in:
@@ -7,11 +7,16 @@ import Quickshell
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property int durShort: 160
|
||||
readonly property int durMed: 220
|
||||
readonly property int durLong: 320
|
||||
readonly property int durShort: 200
|
||||
readonly property int durMed: 400
|
||||
readonly property int durLong: 600
|
||||
|
||||
readonly property int slidePx: 100
|
||||
readonly property int slidePx: 80
|
||||
|
||||
// Material Design 3 motion curves
|
||||
readonly property var emphasized: [0.05, 0, 2/15, 0.06, 1/6, 0.4, 5/24, 0.82, 0.25, 1, 1, 1]
|
||||
readonly property var emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
|
||||
readonly property var standard: [0.2, 0, 0, 1, 1, 1]
|
||||
|
||||
readonly property QtObject direction: QtObject {
|
||||
readonly property int fromLeft: 0
|
||||
@@ -20,30 +25,26 @@ Singleton {
|
||||
}
|
||||
|
||||
readonly property Component slideInLeft: Transition {
|
||||
NumberAnimation { properties: "x"; from: -Anims.slidePx; to: 0; duration: Anims.durMed; easing.type: Easing.OutCubic }
|
||||
NumberAnimation { properties: "opacity"; from: 0.0; to: 1.0; duration: Anims.durShort }
|
||||
NumberAnimation { properties: "x"; from: -Anims.slidePx; to: 0; duration: Anims.durMed; easing.type: Easing.OutQuart }
|
||||
}
|
||||
|
||||
readonly property Component slideOutLeft: Transition {
|
||||
NumberAnimation { properties: "x"; to: -Anims.slidePx; duration: Anims.durShort; easing.type: Easing.InCubic }
|
||||
NumberAnimation { properties: "opacity"; to: 0.0; duration: Anims.durShort }
|
||||
NumberAnimation { properties: "x"; to: -Anims.slidePx; duration: Anims.durShort; easing.type: Easing.InQuart }
|
||||
}
|
||||
|
||||
readonly property Component slideInRight: Transition {
|
||||
NumberAnimation { properties: "x"; from: Anims.slidePx; to: 0; duration: Anims.durMed; easing.type: Easing.OutCubic }
|
||||
NumberAnimation { properties: "opacity"; from: 0.0; to: 1.0; duration: Anims.durShort }
|
||||
NumberAnimation { properties: "x"; from: Anims.slidePx; to: 0; duration: Anims.durMed; easing.type: Easing.OutQuart }
|
||||
}
|
||||
|
||||
readonly property Component slideOutRight: Transition {
|
||||
NumberAnimation { properties: "x"; to: Anims.slidePx; duration: Anims.durShort; easing.type: Easing.InCubic }
|
||||
NumberAnimation { properties: "opacity"; to: 0.0; duration: Anims.durShort }
|
||||
NumberAnimation { properties: "x"; to: Anims.slidePx; duration: Anims.durShort; easing.type: Easing.InQuart }
|
||||
}
|
||||
|
||||
readonly property Component fadeIn: Transition {
|
||||
NumberAnimation { properties: "opacity"; from: 0.0; to: 1.0; duration: Anims.durShort; easing.type: Easing.OutCubic }
|
||||
NumberAnimation { properties: "opacity"; from: 0.0; to: 1.0; duration: Anims.durMed; easing.type: Easing.OutQuart }
|
||||
}
|
||||
|
||||
readonly property Component fadeOut: Transition {
|
||||
NumberAnimation { properties: "opacity"; to: 0.0; duration: Anims.durShort; easing.type: Easing.InCubic }
|
||||
NumberAnimation { properties: "opacity"; to: 0.0; duration: Anims.durShort; easing.type: Easing.InQuart }
|
||||
}
|
||||
}
|
||||
|
||||
9
Common/Ref.qml
Normal file
9
Common/Ref.qml
Normal file
@@ -0,0 +1,9 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
required property Singleton service
|
||||
|
||||
Component.onCompleted: service.refCount++
|
||||
Component.onDestruction: service.refCount--
|
||||
}
|
||||
Reference in New Issue
Block a user