summaryrefslogtreecommitdiff
path: root/core/math/math_funcs.cpp
diff options
context:
space:
mode:
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 5d3887d72c..92236a374f 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