From 57817f7252e3acbe48620b6764a77fecb6bb0ec1 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 6 Nov 2022 17:52:09 +0000 Subject: Added resize transitions --- src/helpers/AnimatedVariable.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/helpers/AnimatedVariable.cpp') 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::system_clock::now() - animationBegin).count(), 0); } + +float CAnimatedVariable::getPercent() { + const auto DURATIONPASSED = std::chrono::duration_cast(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 -- cgit v1.2.3