use curves for special dim anim
This commit is contained in:
parent
759490689c
commit
5d095bb9e1
5 changed files with 24 additions and 7 deletions
|
|
@ -69,4 +69,13 @@ int CAnimatedVariable::getDurationLeftMs() {
|
|||
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);
|
||||
}
|
||||
|
||||
float CAnimatedVariable::getCurveValue() {
|
||||
const auto SPENT = getPercent();
|
||||
|
||||
if (SPENT >= 1.f)
|
||||
return 1.f;
|
||||
|
||||
return g_pAnimationManager->getBezier(m_pConfig->pValues->internalBezier)->getYForPoint(SPENT);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue