button color anims

This commit is contained in:
end-4
2025-04-10 13:09:49 +02:00
parent 15990bf8d1
commit 5c88c6a5a6
2 changed files with 21 additions and 2 deletions
@@ -4,6 +4,7 @@ pragma Singleton
Singleton {
property QtObject m3colors
property QtObject animation
property QtObject colors
property QtObject rounding
property QtObject font
@@ -138,4 +139,12 @@ Singleton {
}
}
animation: QtObject {
property QtObject elementDecel: QtObject {
property int duration: 100
property int type: Easing.BezierSpline
property list<real> bezierCurve: [0, 0.55, 0.45, 1]
}
}
}
@@ -8,18 +8,28 @@ import Quickshell.Wayland
Button {
id: button
implicitWidth: 26
implicitHeight: 26
required default property Item content
property bool extraActiveCondition: false
implicitWidth: 26
implicitHeight: 26
contentItem: content
background: Rectangle {
anchors.fill: parent
radius: Appearance.rounding.full
color: (button.down || extraActiveCondition) ? Appearance.colors.colLayer2Active : (button.hovered ? Appearance.colors.colLayer2Hover : Appearance.colors.colLayer2)
Behavior on color {
ColorAnimation {
duration: Appearance.animation.elementDecel.duration
easing.type: Appearance.animation.elementDecel.type
easing.bezierCurve: Appearance.animation.elementDecel.bezierCurve
}
}
}
}