diff --git a/ui/effects/animation_value.cpp b/ui/effects/animation_value.cpp index 6b6b299..934d9c8 100644 --- a/ui/effects/animation_value.cpp +++ b/ui/effects/animation_value.cpp @@ -19,7 +19,12 @@ int SlowMultiplierMinusOne/* = 0*/; } // namespace transition linear = [](const float64 &delta, const float64 &dt) { - return delta * dt; + Expects(!std::isnan(delta)); + Expects(!std::isnan(dt)); + + const auto result = delta * dt; + Ensures(!std::isnan(result)); + return result; }; transition sineInOut = [](const float64 &delta, const float64 &dt) { diff --git a/ui/effects/animations.h b/ui/effects/animations.h index e7fd974..bdc3a45 100644 --- a/ui/effects/animations.h +++ b/ui/effects/animations.h @@ -345,9 +345,12 @@ inline void Simple::start( Assert(!std::isnan(that->delta)); Assert(!std::isnan(that->duration)); const auto finished = (time >= that->duration); + Assert(finished || that->duration > 0); + const auto progressRatio = finished ? 1. : time / that->duration; + Assert(!std::isnan(progressRatio)); const auto progress = finished ? that->delta - : that->transition(that->delta, time / that->duration); + : that->transition(that->delta, progressRatio); Assert(!std::isnan(that->from)); Assert(!std::isnan(progress)); that->value = that->from + progress;