summaryrefslogtreecommitdiff
path: root/src/helpers/AnimatedVariable.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-06 17:52:09 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-06 17:52:09 +0000
commit57817f7252e3acbe48620b6764a77fecb6bb0ec1 (patch)
tree90235b12f926d50c0f3c1250e0aff8641f29614c /src/helpers/AnimatedVariable.cpp
parentb4c45aa2e3af0e595a6276986290c78d11465746 (diff)
Added resize transitions
Diffstat (limited to 'src/helpers/AnimatedVariable.cpp')
-rw-r--r--src/helpers/AnimatedVariable.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/helpers/AnimatedVariable.cpp b/src/helpers/AnimatedVariable.cpp
index 77707349..18162c99 100644
--- a/src/helpers/AnimatedVariable.cpp
+++ b/src/helpers/AnimatedVariable.cpp
@@ -66,3 +66,8 @@ void CAnimatedVariable::registerVar() {
int CAnimatedVariable::getDurationLeftMs() {
return std::max((int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0);
}
+
+float CAnimatedVariable::getPercent() {
+ const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count();
+ return std::clamp((DURATIONPASSED / 100.f) / m_pConfig->pValues->internalSpeed, 0.f, 1.f);
+} \ No newline at end of file