Closed tayl0r closed 12 years ago
After looking and thinking about this issue some more I figured out how to easily fix the existing bounce easing method.
public static class Bounce
{
const float b = 0f;
const float c = 1f;
const float d = 1f;
public static float easeOut(float t)
{
if ((t /= d) < (1 / 2.75))
{
return c * (7.5625f * t * t) + b;
}
else if (t < (2 / 2.75))
{
return c * (7.5625f * (t -= (1.5f / 2.75f)) * t + .75f) + b;
}
else if (t < (2.5 / 2.75))
{
return c * (7.5625f * (t -= (2.25f / 2.75f)) * t + .9375f) + b;
}
else
{
return c * (7.5625f * (t -= (2.625f / 2.75f)) * t + .984375f) + b;
}
}
public static float easeIn(float t)
{
return c - easeOut(d - t) + b;
}
public static float easeInOut(float t)
{
if (t < d / 2) return easeIn(t * 2) * 0.5f + b;
else return easeOut(t * 2 - d) * .5f + c * 0.5f + b;
}
}
The bounce easing function does not really bounce like you expect a bounce easing function to bounce.
I'm not sure if the existing bounce easing function is fixable. I messed with it for a bit but I couldn't get it to look right.
I was able to add a new .scaleTo override that takes a Function<float, float, float, float, float> so you can use the the GoToolkit easing functions and then the bounce works as you would expect.
Is it possible to fix the existing bounce ease or should we just convert all the easing functions to use Function<float, float, float, float, float> so you can use the existing well published easing functions?
http://robertpenner.com/easing/ http://timotheegroleau.com/Flash/experiments/easing_function_generator.htm