diff options
author | kobewi <kobewi4e@gmail.com> | 2021-09-17 00:50:07 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2021-09-24 13:02:49 +0200 |
commit | 5c1195e456a168486c251340275ad8e9193873e9 (patch) | |
tree | adfc561c96ce021f976e0e3fcd981b2b4f7fe237 /thirdparty | |
parent | 60d67f93c6757834be912a48f2ca23b31a69ad5f (diff) |
Add a special case for 0-time interpolations
Diffstat (limited to 'thirdparty')
-rw-r--r-- | thirdparty/misc/easing_equations.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/thirdparty/misc/easing_equations.cpp b/thirdparty/misc/easing_equations.cpp index ce32c1a362..d164e3d560 100644 --- a/thirdparty/misc/easing_equations.cpp +++ b/thirdparty/misc/easing_equations.cpp @@ -312,6 +312,10 @@ Tween::interpolater Tween::interpolaters[Tween::TRANS_MAX][Tween::EASE_MAX] = { }; real_t Tween::run_equation(TransitionType p_trans_type, EaseType p_ease_type, real_t t, real_t b, real_t c, real_t d) { + if (d == 0) { + // Special case to avoid dividing by 0 in equations. + return b + c; + } interpolater cb = interpolaters[p_trans_type][p_ease_type]; ERR_FAIL_COND_V(cb == NULL, b); |