summaryrefslogtreecommitdiff
path: root/core/math/math_funcs.cpp
diff options
context:
space:
mode:
authorsanikoyes <sanikoyes@163.com>2014-04-06 21:52:47 +0800
committersanikoyes <sanikoyes@163.com>2014-04-06 21:52:47 +0800
commit77a840e350668a9c80b1e63b9b73aac44221c53b (patch)
tree40d2115e639bdc72a61811ac4f2fb0f04ec8eb7f /core/math/math_funcs.cpp
parent14bbdcb139b35e6d206df1ab3176d34245b72329 (diff)
parentded365031ede27b7a6efef59bc886343f58d310b (diff)
Merge branch 'master' into hotfix-android-unicode-ime-input
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