1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-03 12:08:31 -04:00

animations: add DankColorAnimation helper to properly animate between

colors with different alpha values
fixes #2720
This commit is contained in:
bbedward
2026-07-03 15:36:45 -04:00
parent 3253adb6dd
commit 930a36bcfc
7 changed files with 95 additions and 41 deletions
@@ -1283,10 +1283,15 @@ Item {
readonly property color requestedColor: isActive ? activeColor : isUrgent ? urgentColor : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.withAlpha(unfocusedColor, 0.7) : isOccupied ? occupiedColor : unfocusedColor
property color displayColor: requestedColor
property bool colorAnimationReady: false
onRequestedColorChanged: Qt.callLater(() => delegateRoot.displayColor = delegateRoot.requestedColor)
readonly property color displayColor: pillColor.value
DankColorAnimation {
id: pillColor
to: delegateRoot.requestedColor
animated: delegateRoot.colorAnimationReady
}
Item {
id: dragHandler
@@ -1560,14 +1565,6 @@ Item {
}
}
Behavior on color {
enabled: delegateRoot.colorAnimationReady
ColorAnimation {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on border.width {
NumberAnimation {
duration: Theme.mediumDuration
+7 -11
View File
@@ -424,26 +424,22 @@ Item {
id: surface
anchors.fill: parent
radius: rowItem.dragging ? Theme.cornerRadius + 6 : Theme.cornerRadius
color: {
if (rowItem.dragging)
return Theme.secondaryContainer;
const base = Theme.surfaceContainer;
return Theme.withAlpha(base, rowItem.isEnabled ? 0.7 : 0.4);
}
color: surfaceColor.value
border.width: rowItem.dragging ? 2 : 1
border.color: rowItem.dragging ? Theme.primary : Theme.outlineHeavy
DankColorAnimation {
id: surfaceColor
to: rowItem.dragging ? Theme.secondaryContainer : Theme.withAlpha(Theme.surfaceContainer, rowItem.isEnabled ? 0.7 : 0.4)
duration: Theme.shortDuration
}
Behavior on radius {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Easing.OutCubic
}
}
Behavior on color {
ColorAnimation {
duration: Theme.shortDuration
}
}
Behavior on border.color {
ColorAnimation {
duration: Theme.shortDuration
@@ -279,7 +279,7 @@ Column {
scale: delegateItem.dragging ? 1.02 : 1.0
transformOrigin: Item.Center
radius: delegateItem.dragging ? Theme.cornerRadius + 6 : Theme.cornerRadius
color: delegateItem.dragging ? Theme.secondaryContainer : Theme.withAlpha(Theme.surfaceContainer, modelData.enabled ? 0.7 : 0.4)
color: itemColor.value
border.color: delegateItem.dragging ? Theme.primary : Theme.outlineHeavy
border.width: delegateItem.dragging ? 2 : 1
@@ -295,10 +295,10 @@ Column {
easing.type: Easing.OutCubic
}
}
Behavior on color {
ColorAnimation {
duration: Theme.shortDuration
}
DankColorAnimation {
id: itemColor
to: delegateItem.dragging ? Theme.secondaryContainer : Theme.withAlpha(Theme.surfaceContainer, modelData.enabled ? 0.7 : 0.4)
duration: Theme.shortDuration
}
Behavior on border.color {
ColorAnimation {