[Bf-blender-cvs] [179e7ea] master: Bugfix for Elastic and Back easing types

Joshua Leung noreply at git.blender.org
Thu Jun 19 15:38:47 CEST 2014


Commit: 179e7eaf394481c10b66b4db762e8189aa5a0a2a
Author: Joshua Leung
Date:   Fri Jun 20 01:28:45 2014 +1200
https://developer.blender.org/rB179e7eaf394481c10b66b4db762e8189aa5a0a2a

Bugfix for Elastic and Back easing types

** TO BE PORTED BACK TO 2.71 **

As pointed out by Thomas Beck (plasmasolutions), the current behaviour and/or
default values for their parameters didn't quite make sense:

1) Back Easing - The old default value of 0.0 results in some overshoot being applied,
while trying to tweak it up or down resulted in some odd jumps and discontinities.

I've ended up removing some code here which forcibly using a "back" value of 1.7
when users wanted 0.0 instead. There doesn't seem to be any good reason for this.
To ensure that there is still an effect initially, keyframes now get created
with back set to 1.7


2) Elastic Easing - The old default settings of <amplitude = 0, period = 0> resulted
in a curve without any elastic bounce, which wasn't very useful for motion graphics.

Now, default values of amplitude = 0.8 and period = 4.1 get set. These were hand picked
by Thomas to work well when the duration of the motion is 10 frames long (i.e. the
typical length of such effects when doing motion graphics).

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

M	source/blender/blenlib/intern/easing.c
M	source/blender/editors/animation/keyframing.c

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

diff --git a/source/blender/blenlib/intern/easing.c b/source/blender/blenlib/intern/easing.c
index 1f39c2f..80f02d5 100644
--- a/source/blender/blenlib/intern/easing.c
+++ b/source/blender/blenlib/intern/easing.c
@@ -43,24 +43,18 @@
 
 float BLI_easing_back_ease_in(float time, float begin, float change, float duration, float overshoot)
 {
-	if (overshoot == 0.0f)
-		overshoot = 1.70158f;
 	time /= duration;
 	return change * time * time * ((overshoot + 1) * time - overshoot) + begin;
 }
 
 float BLI_easing_back_ease_out(float time, float begin, float change, float duration, float overshoot)
 {
-	if (overshoot == 0.0f)
-		overshoot = 1.70158f;
 	time = time / duration - 1;
 	return change * (time * time * ((overshoot + 1) * time + overshoot) + 1) + begin;
 }
 
 float BLI_easing_back_ease_in_out(float time, float begin, float change, float duration, float overshoot)
 {
-	if (overshoot == 0.0f)
-		overshoot = 1.70158f; 
 	overshoot *= 1.525f;
 	if ((time /= duration / 2) < 1.0f) {
 		return change / 2 * (time * time * ((overshoot + 1) * time - overshoot)) + begin;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index c3573a3..878c919 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -420,6 +420,17 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, short flag)
 		beztr.ipo = BEZT_IPO_LIN;
 	}
 	
+	/* set default values for "easing" interpolation mode settings
+	 * NOTE: Even if these modes aren't currently used, if users switch
+	 *       to these later, we want these to work in a sane way out of
+	 *       the box.
+	 */
+	beztr.back = 1.70158f;     /* "back" easing - this value used to be used when overshoot=0, but that        */
+	                           /*                 introduced discontinuities in how the param worked           */
+	
+	beztr.amplitude = 0.8f;    /* "elastic" easing - values here were hand-optimised for a default duration of */
+	beztr.period = 4.1f;       /*                    ~10 frames (typical mograph motion length)                */
+	
 	/* add temp beztriple to keyframes */
 	a = insert_bezt_fcurve(fcu, &beztr, flag);




More information about the Bf-blender-cvs mailing list