////////////////////////////////////////////// // Elastic Function ///////////////////////////////////////////// #region Elastic /// <summary> /// /// </summary> /// <param name="inOutType">How should use sine lerp </param> /// <param name="time">Current Time of lerp</param> /// <param name="a">Beginning value of lerp</param> /// <param name="b">Final value of lerp</param> /// <param name="lerpTotal">Total time between lerps</param> /// <returns>Lerp Value</returns> static float EaseElastic(EasingInOutType inOutType, float time, float a, float b, float lerpTotal = 1.0f) { switch (inOutType) { case EasingInOutType.EaseIn: { return(EaseInElastic(time, a, b, lerpTotal)); } case EasingInOutType.EaseOut: { return(EaseOutElastic(time, a, b, lerpTotal)); } case EasingInOutType.EaseInOut: { return(EaseInOutElastic(time, a, b, lerpTotal)); } default: { return(EaseInElastic(time, a, b, lerpTotal)); } } }
/// <summary> /// Easy use of all Easing lerp function /// </summary> /// <param name="type">The type of Lerp</param> /// <param name="inOutType">Which type of effect</param> /// <param name="time">Current time</param> /// <param name="a">Starting Value</param> /// <param name="b">Ending Value</param> /// <param name="lerpTotal">Lerp total time</param> /// <returns>Lerp Value</returns> public static float EasingLerp(EasingLerpsType type, EasingInOutType inOutType, float time, float a, float b, float lerpTotal = 1.0f) { switch (type) { case EasingLerpsType.Sine: { return(EaseSine(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Quad: { return(EaseQuad(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Cubic: { return(EaseCubic(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Quint: { return(EaseQuint(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Expo: { return(EaseExpo(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Circ: { return(EaseCirc(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Back: { return(EaseBack(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Elastic: { return(EaseElastic(inOutType, time, a, b, lerpTotal)); } case EasingLerpsType.Bounce: { return(EaseBounce(inOutType, time, a, b, lerpTotal)); } default: { return(EaseSine(inOutType, time, a, b, lerpTotal)); } } }
public static IEasing GetEasing(EasingType type, EasingInOutType inOutType) { return(_dic[type][inOutType]); }