CSharp examples for System:Math Easing Function
Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity.
using System;//from w w w. j ava 2s. c om public class Main{ /// <summary> /// Easing equation function for an elastic (exponentially decaying sine wave) easing out: /// decelerating from zero velocity. /// </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 ElasticEaseOut( double t, double b, double c, double d ) { if ( ( t /= d ) == 1 ) return b + c; double p = d * .3; double s = p / 4; return ( c * Math.Pow( 2, -10 * t ) * Math.Sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b ); } }