[Bf-blender-cvs] [e158fbf] master: f-curve easing: make ease in/out expressions consistent

Campbell Barton noreply at git.blender.org
Mon Apr 28 19:23:15 CEST 2014


Commit: e158fbf9349379e137a5cdb840c36dba170372d1
Author: Campbell Barton
Date:   Tue Apr 29 03:21:32 2014 +1000
https://developer.blender.org/rBe158fbf9349379e137a5cdb840c36dba170372d1

f-curve easing: make ease in/out expressions consistent

===================================================================

M	source/blender/blenlib/intern/easing.c

===================================================================

diff --git a/source/blender/blenlib/intern/easing.c b/source/blender/blenlib/intern/easing.c
index 62e4b58..7233a26 100644
--- a/source/blender/blenlib/intern/easing.c
+++ b/source/blender/blenlib/intern/easing.c
@@ -202,13 +202,16 @@ float BLI_easing_elastic_ease_in_out(float time, float begin, float change, floa
 	}
 	else
 		s = period / (2 * (float)M_PI) * asinf(change / amplitude);
-	if (time < 1.0f) {
-		time -= 1.0f;
-		return -0.5f * (amplitude * powf(2, 10 * time) * sinf((time * duration - s) * (2 * (float)M_PI) / period)) + begin;
-	}
 
 	time -= 1.0f;
-	return amplitude * powf(2, -10 * time) * sinf((-time * duration - s) * (2 * (float)M_PI) / period) * 0.5f + change + begin;
+
+	if (time < 0.0f) {
+		return -0.5f * (amplitude * powf(2, 10 * time) * sinf((time * duration - s) * (2 * (float)M_PI) / period)) + begin;
+	}
+	else {
+		time = -time;
+		return (0.5f * amplitude * powf(2, 10 * time) * sinf((time * duration - s) * (2 * (float)M_PI) / period)) + change + begin;
+	}
 }
 
 float BLI_easing_expo_ease_in(float time, float begin, float change, float duration)




More information about the Bf-blender-cvs mailing list