From 9ee5ff1f7181cc5fa575f1702802ccb78c21ba12 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Wed, 29 Apr 2026 21:31:06 +0100 Subject: animations: add springs (#14171) --- src/managers/animation/AnimationManager.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/managers/animation/AnimationManager.cpp') diff --git a/src/managers/animation/AnimationManager.cpp b/src/managers/animation/AnimationManager.cpp index 687f5f2c..c5c3ca54 100644 --- a/src/managers/animation/AnimationManager.cpp +++ b/src/managers/animation/AnimationManager.cpp @@ -42,7 +42,7 @@ static void updateVariable(CAnimatedVariable& av, const float POINTY, b av.value() = av.begun() + DELTA * POINTY; } -static void updateColorVariable(CAnimatedVariable& av, const float POINTY, bool warp) { +static void updateColorVariable(CAnimatedVariable& av, const float POINTY, bool warp = false) { if (warp || av.value() == av.goal()) { av.warp(true, false); return; @@ -139,15 +139,12 @@ static void handleUpdate(CAnimatedVariable& av, bool warp) { animationsDisabled = animationsDisabled || ls->m_ruleApplicator->noanim().valueOrDefault(); } - const auto SPENT = av.getPercent(); - const auto PBEZIER = g_pAnimationManager->getBezier(av.getBezierName()); - const auto POINTY = PBEZIER->getYForPoint(SPENT); - const bool WARP = animationsDisabled || SPENT >= 1.f; + const auto STEP = av.getCurveStep(); if constexpr (std::same_as) - updateColorVariable(av, POINTY, WARP); + updateColorVariable(av, STEP.value, STEP.finished); else - updateVariable(av, POINTY, WARP); + updateVariable(av, STEP.value, STEP.finished); av.onUpdate(); } -- cgit v1.2.3