Skip to content

Commit

Permalink
animationmgr: don't warp based on POINTY value
Browse files Browse the repository at this point in the history
  • Loading branch information
PaideiaDilemma committed Jan 9, 2025
1 parent c9822b0 commit 411e4ce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/managers/AnimationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CHyprAnimationManager::CHyprAnimationManager() {

template <Animable VarType>
void updateVariable(CAnimatedVariable<VarType>& av, const float POINTY, bool warp = false) {
if (POINTY >= 1.f || warp || av.value() == av.goal()) {
if (warp || av.value() == av.goal()) {
av.warp();
return;
}
Expand All @@ -50,7 +50,7 @@ void updateVariable(CAnimatedVariable<VarType>& av, const float POINTY, bool war
}

void updateColorVariable(CAnimatedVariable<CHyprColor>& av, const float POINTY, bool warp) {
if (POINTY >= 1.f || warp || av.value() == av.goal()) {
if (warp || av.value() == av.goal()) {
av.warp();
return;
}
Expand Down Expand Up @@ -146,11 +146,12 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
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;

if constexpr (std::same_as<VarType, CHyprColor>)
updateColorVariable(av, POINTY, animationsDisabled);
updateColorVariable(av, POINTY, WARP);
else
updateVariable<VarType>(av, POINTY, animationsDisabled);
updateVariable<VarType>(av, POINTY, WARP);

av.onUpdate();

Expand Down

0 comments on commit 411e4ce

Please sign in to comment.