Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-28 21:21:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-28 21:21:32 +0400
commite158fbf9349379e137a5cdb840c36dba170372d1 (patch)
tree71a12e87d450719a367c47e5d48d69532039e9b4 /source/blender/blenlib/intern/easing.c
parentb5feb1940d3e1f7198b8fc72f2f9fec192e38d1e (diff)
f-curve easing: make ease in/out expressions consistent
Diffstat (limited to 'source/blender/blenlib/intern/easing.c')
-rw-r--r--source/blender/blenlib/intern/easing.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/easing.c b/source/blender/blenlib/intern/easing.c
index 62e4b5880fb..7233a26cb4d 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)