Ease Back in and out. - CSharp System

CSharp examples for System:Math Easing Function

Description

Ease Back in and out.

Demo Code


using System;/*from  ww  w .ja  v  a  2 s  . c o m*/

public class Main{
        /// <summary>
        /// Back in and out.
        /// </summary>
        /// <param name="t">Time elapsed.</param>
        /// <returns>Eased timescale.</returns>
        public static float BackInOut(float t) {
            t *= 2;
            if (t < 1) return (float)(t * t * (2.70158 * t - 1.70158) / 2);
            t--;
            return (float)((1 - (--t) * (t) * (-2.70158 * t - 1.70158)) / 2 + .5);
        }
}

Related Tutorials