summaryrefslogtreecommitdiff
path: root/src/managers/animation/AnimationManager.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-04-29 21:31:06 +0100
committerGitHub <noreply@github.com>2026-04-29 21:31:06 +0100
commit9ee5ff1f7181cc5fa575f1702802ccb78c21ba12 (patch)
treeaab51303b4d045d0633cfe122069456694fdf2e0 /src/managers/animation/AnimationManager.cpp
parent45ffaee09361110c018e962dbb3d93f7f1ee8e09 (diff)
animations: add springs (#14171)
Diffstat (limited to 'src/managers/animation/AnimationManager.cpp')
-rw-r--r--src/managers/animation/AnimationManager.cpp11
1 files changed, 4 insertions, 7 deletions
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<VarType>& av, const float POINTY, b
av.value() = av.begun() + DELTA * POINTY;
}
-static void updateColorVariable(CAnimatedVariable<CHyprColor>& av, const float POINTY, bool warp) {
+static void updateColorVariable(CAnimatedVariable<CHyprColor>& 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<VarType>& 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<VarType, CHyprColor>)
- updateColorVariable(av, POINTY, WARP);
+ updateColorVariable(av, STEP.value, STEP.finished);
else
- updateVariable<VarType>(av, POINTY, WARP);
+ updateVariable<VarType>(av, STEP.value, STEP.finished);
av.onUpdate();
}