CSharp examples for System:Math Easing Function
Easing equation function for an exponential (2^t) easing inout: acceleration until halfway, then deceleration.
using System;//from ww w . j a v a 2 s . com public class Main{ /// <summary> /// Easing equation function for an exponential (2^t) easing in/out: /// acceleration until halfway, then deceleration. /// </summary> /// <param name="t">Current time in seconds.</param> /// <param name="b">Starting value.</param> /// <param name="c">Change in value.</param> /// <param name="d">Duration of animation.</param> /// <returns>The correct value.</returns> public static double ExpoEaseInOut( double t, double b, double c, double d ) { if ( t == 0 ) return b; if ( t == d ) return b + c; if ( ( t /= d / 2 ) < 1 ) return c / 2 * Math.Pow( 2, 10 * ( t - 1 ) ) + b; return c / 2 * ( -Math.Pow( 2, -10 * --t ) + 2 ) + b; } }