fix: sync colon and seconds bar animations to clock tick; colon no longer self-loops

This commit is contained in:
Damocles 2026-04-15 19:51:37 +02:00
parent a7f0fd2785
commit f5e076c7ac

View file

@ -105,6 +105,7 @@ PanelWindow {
font.pixelSize: 72 font.pixelSize: 72
font.family: M.Theme.fontFamily font.family: M.Theme.fontFamily
font.bold: true font.bold: true
opacity: 0.85
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
property int _colorIdx: 0 property int _colorIdx: 0
@ -113,13 +114,13 @@ PanelWindow {
Behavior on color { Behavior on color {
enabled: !M.Theme.reducedMotion enabled: !M.Theme.reducedMotion
ColorAnimation { ColorAnimation {
duration: 800 duration: 500
} }
} }
// Fired once per second in sync with the clock tick
SequentialAnimation { SequentialAnimation {
loops: Animation.Infinite id: colonAnim
running: !M.Theme.reducedMotion
NumberAnimation { NumberAnimation {
target: colon target: colon
property: "opacity" property: "opacity"
@ -127,12 +128,6 @@ PanelWindow {
duration: 150 duration: 150
easing.type: Easing.InOutSine easing.type: Easing.InOutSine
} }
PauseAnimation {
duration: 700
}
ScriptAction {
script: colon._colorIdx++
}
NumberAnimation { NumberAnimation {
target: colon target: colon
property: "opacity" property: "opacity"
@ -140,8 +135,15 @@ PanelWindow {
duration: 150 duration: 150
easing.type: Easing.InOutSine easing.type: Easing.InOutSine
} }
PauseAnimation { }
duration: 700
Connections {
target: clock
function onDateChanged() {
if (M.Theme.reducedMotion)
return;
colon._colorIdx++;
colonAnim.restart();
} }
} }
} }