aboutsummaryrefslogtreecommitdiff
path: root/core/math/math_funcs.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2014-03-13 22:57:24 -0300
committerJuan Linietsky2014-03-13 22:57:24 -0300
commit31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b (patch)
treeb6d3a290333c72940b49ed4c930ff6858a59515e /core/math/math_funcs.cpp
parenta65edb4caabec21654c56552e11aacf0fd9291de (diff)
downloadgodot-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.cpp11
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