diff options
| author | Juan Linietsky | 2014-03-13 22:57:24 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2014-03-13 22:57:24 -0300 |
| commit | 31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b (patch) | |
| tree | b6d3a290333c72940b49ed4c930ff6858a59515e /core/math/math_funcs.cpp | |
| parent | a65edb4caabec21654c56552e11aacf0fd9291de (diff) | |
| download | godot-31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b.tar.gz godot-31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b.tar.zst godot-31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b.zip | |
Diffstat (limited to 'core/math/math_funcs.cpp')
| -rw-r--r-- | core/math/math_funcs.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index 5d3887d72..92236a374 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -220,9 +220,16 @@ int Math::decimals(double p_step) { double Math::ease(double p_x, double p_c) { + if (p_x<0) + p_x=0; + else if (p_x>1.0) + p_x=1.0; if (p_c>0) { - - return Math::pow(p_x,p_c); + if (p_c<1.0) { + return 1.0-Math::pow(1.0-p_x,1.0/p_c); + } else { + return Math::pow(p_x,p_c); + } } else if (p_c<0) { //inout ease |
