From 604424869dca207ef02e17202c25d7cdf76edf7e Mon Sep 17 00:00:00 2001 From: mx Date: Thu, 26 Nov 2026 14:09:38 +0100 Subject: [PATCH] Time drawer animations by their direction, so closing speeds apply The duration was picked from `open`, which can update after the progress animation has already started, so closes ran at the opening speed. Use the Behavior's target value instead. Co-Authored-By: Claude Opus 5.5 --- quickshell/components/BarDrawer.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/quickshell/components/BarDrawer.qml b/quickshell/components/BarDrawer.qml index 89176e5..fc083e5 100644 --- a/quickshell/components/BarDrawer.qml +++ b/quickshell/components/BarDrawer.qml @@ -50,13 +50,17 @@ Item { // Content parent, for items reparented in at runtime. readonly property alias container: inner // Enter: emphasized decelerate; exit: emphasized accelerate (Material 3). + // Timing follows where the animation is heading, not `open`: both bindings + // depend on `open`, and the animation can start before the duration updates. Behavior on progress { + id: motionBehavior NumberAnimation { id: anim - duration: root.liquid ? (root.open ? Theme.notchPanelOpenDuration : Theme.notchPanelCloseDuration) : root.open ? root.openDuration : root.closeDuration + readonly property bool opening: motionBehavior.targetValue > 0.5 + duration: root.liquid ? (anim.opening ? Theme.notchPanelOpenDuration : Theme.notchPanelCloseDuration) : anim.opening ? root.openDuration : root.closeDuration // NotchDrop eases each phase itself. easing.type: root.liquid ? Easing.Linear : Easing.BezierSpline - easing.bezierCurve: root.open ? [0.05, 0.7, 0.1, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1] + easing.bezierCurve: anim.opening ? [0.05, 0.7, 0.1, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1] } } implicitWidth: contentWidth + 2 * ear