summaryrefslogtreecommitdiff
path: root/src/managers/AnimationManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-30 13:11:10 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-30 13:11:10 +0200
commitd1564299d23b52e6297fa4542ce42e4a54c28cbc (patch)
treeef7b00a0114630b3cdd5a550dae603c8ce99fb45 /src/managers/AnimationManager.cpp
parentcfc1f6c211b055dc54b91e1ed94aef120c9c143c (diff)
fix minor bug with new anim optimization
Diffstat (limited to 'src/managers/AnimationManager.cpp')
-rw-r--r--src/managers/AnimationManager.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index c26ea5f2..5e3df81f 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -37,6 +37,11 @@ void CAnimationManager::tick() {
DEFAULTBEZIER = m_mBezierCurves.find("default");
for (auto& av : m_lAnimatedVariables) {
+
+ // first of all, check if we need to update it at all
+ if (!av->isBeingAnimated())
+ continue;
+
// get speed
const auto SPEED = *av->m_pSpeed == 0 ? *PANIMSPEED : *av->m_pSpeed;
@@ -44,12 +49,6 @@ void CAnimationManager::tick() {
const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - av->animationBegin).count();
const float SPENT = std::clamp((DURATIONPASSED / 100.f) / SPEED, 0.f, 1.f);
- // first of all, check if we need to update it at all
- if (SPENT >= 1.f) {
- av->warp();
- continue;
- }
-
// window stuff
const auto PWINDOW = (CWindow*)av->m_pWindow;
const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace;
@@ -76,6 +75,11 @@ void CAnimationManager::tick() {
break;
}
+ if (SPENT >= 1.f) {
+ av->warp();
+ break;
+ }
+
const auto DELTA = av->m_fGoal - av->m_fBegun;
const auto BEZIER = m_mBezierCurves.find(*av->m_pBezier);
@@ -92,6 +96,11 @@ void CAnimationManager::tick() {
break;
}
+ if (SPENT >= 1.f) {
+ av->warp();
+ break;
+ }
+
const auto DELTA = av->m_vGoal - av->m_vBegun;
const auto BEZIER = m_mBezierCurves.find(*av->m_pBezier);
@@ -108,6 +117,11 @@ void CAnimationManager::tick() {
break;
}
+ if (SPENT >= 1.f) {
+ av->warp();
+ break;
+ }
+
const auto DELTA = av->m_cGoal - av->m_cBegun;
const auto BEZIER = m_mBezierCurves.find(*av->m_pBezier);