ahmd0 ahmd0 - 1 month ago 13
C# Question

Ease-in and ease-out animation formula

Say, if I'm doing the Ease-Out and then Ease-In animation of an object's movement from X1 coordinate to X2 coordinate over S steps at equal time intervals. Can some suggest the formula to calculate this movement's X coordinates?

Answer

Quadratic ease out where t = time, b = startvalue, c = change in value, d = duration:

 function (t, b, c, d) {
     t /= d/2;
     if (t < 1) return c/2*t*t + b;
     t--;
     return -c/2 * (t*(t-2) - 1) + b;
 };

source: http://gizma.com/easing/