Color animations: more uniform across NWidgets

This commit is contained in:
LemmyCook 2025-08-31 21:36:30 -04:00
parent 102aca0fa0
commit d1f5d301c2
7 changed files with 60 additions and 16 deletions

View file

@ -37,6 +37,18 @@ RowLayout {
border.color: root.checked ? root.activeColor : Color.mOutline border.color: root.checked ? root.activeColor : Color.mOutline
border.width: Math.max(1, Style.borderM * scaling) border.width: Math.max(1, Style.borderM * scaling)
Behavior on color {
ColorAnimation {
duration: Style.animationNormal
}
}
Behavior on border.color {
ColorAnimation {
duration: Style.animationNormal
}
}
NIcon { NIcon {
visible: root.checked visible: root.checked
anchors.centerIn: parent anchors.centerIn: parent
@ -59,16 +71,5 @@ RowLayout {
} }
onClicked: root.toggled(!root.checked) onClicked: root.toggled(!root.checked)
} }
Behavior on color {
ColorAnimation {
duration: Style.animationFast
}
}
Behavior on border.color {
ColorAnimation {
duration: Style.animationFast
}
}
} }
} }

View file

@ -56,6 +56,12 @@ RowLayout {
border.color: combo.activeFocus ? Color.mSecondary : Color.mOutline border.color: combo.activeFocus ? Color.mSecondary : Color.mOutline
border.width: Math.max(1, Style.borderS * scaling) border.width: Math.max(1, Style.borderS * scaling)
radius: Style.radiusM * scaling radius: Style.radiusM * scaling
Behavior on border.color {
ColorAnimation {
duration: Style.animationFast
}
}
} }
contentItem: NText { contentItem: NText {
@ -113,12 +119,22 @@ RowLayout {
color: highlighted ? Color.mSurface : Color.mOnSurface color: highlighted ? Color.mSurface : Color.mOnSurface
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
Behavior on color {
ColorAnimation {
duration: Style.animationFast
}
}
} }
background: Rectangle { background: Rectangle {
width: combo.width - Style.marginM * scaling * 3 width: combo.width - Style.marginM * scaling * 3
color: highlighted ? Color.mSecondary : Color.transparent color: highlighted ? Color.mTertiary : Color.transparent
radius: Style.radiusS * scaling radius: Style.radiusS * scaling
Behavior on color {
ColorAnimation {
duration: Style.animationFast
}
}
} }
} }
} }

View file

@ -25,12 +25,17 @@ RadioButton {
radius: width * 0.5 radius: width * 0.5
color: Qt.alpha(Color.mPrimary, root.checked ? 1 : 0) color: Qt.alpha(Color.mPrimary, root.checked ? 1 : 0)
Behavior on color {
ColorAnimation {
duration: Style.animationFast
}
}
} }
Behavior on border.color { Behavior on border.color {
ColorAnimation { ColorAnimation {
duration: Style.animationNormal duration: Style.animationFast
easing.type: Easing.InQuad
} }
} }
} }

View file

@ -77,6 +77,12 @@ Slider {
border.color: Color.mPrimary border.color: Color.mPrimary
border.width: Math.max(1, Style.borderL * scaling) border.width: Math.max(1, Style.borderL * scaling)
Behavior on color {
ColorAnimation {
duration: Style.animationFast
}
}
// Press feedback halo (using accent color, low opacity) // Press feedback halo (using accent color, low opacity)
Rectangle { Rectangle {
anchors.centerIn: parent anchors.centerIn: parent

View file

@ -49,7 +49,6 @@ RowLayout {
Behavior on border.color { Behavior on border.color {
ColorAnimation { ColorAnimation {
duration: Style.animationFast duration: Style.animationFast
easing.type: Easing.InOutCubic
} }
} }
@ -126,7 +125,6 @@ RowLayout {
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: Style.animationFast duration: Style.animationFast
easing.type: Easing.InOutCubic
} }
} }

View file

@ -51,6 +51,12 @@ ColumnLayout {
color: Color.transparent color: Color.transparent
border.color: input.activeFocus ? Color.mSecondary : Color.transparent border.color: input.activeFocus ? Color.mSecondary : Color.transparent
border.width: input.activeFocus ? Math.max(1, Style.borderS * scaling) : 0 border.width: input.activeFocus ? Math.max(1, Style.borderS * scaling) : 0
Behavior on border.color {
ColorAnimation {
duration: Style.animationFast
}
}
} }
RowLayout { RowLayout {

View file

@ -34,6 +34,18 @@ RowLayout {
border.color: root.checked ? Color.mPrimary : Color.mOutline border.color: root.checked ? Color.mPrimary : Color.mOutline
border.width: Math.max(1, Style.borderM * scaling) border.width: Math.max(1, Style.borderM * scaling)
Behavior on color {
ColorAnimation {
duration: Style.animationFast
}
}
Behavior on border.color {
ColorAnimation {
duration: Style.animationFast
}
}
Rectangle { Rectangle {
implicitWidth: (root.baseSize - 5) * scaling implicitWidth: (root.baseSize - 5) * scaling
implicitHeight: (root.baseSize - 5) * scaling implicitHeight: (root.baseSize - 5) * scaling