Beispiel #1
0
        /// <summary>
        /// 插值入口
        /// </summary>
        /// <returns></returns>
        float GetInterp(float fromValue, float aimValue, float current, float total)
        {
            switch (easeType)
            {
            case Ease.InBack:
                return(TweenMath.InBack(fromValue, aimValue, current, total));

            case Ease.OutBack:
                return(TweenMath.OutBack(fromValue, aimValue, current, total));

            case Ease.InOutBack:
                return(TweenMath.InOutBack(fromValue, aimValue, current, total));

            case Ease.OutInBack:
                return(TweenMath.OutInBack(fromValue, aimValue, current, total));

            case Ease.InQuad:
                return(TweenMath.InQuad(fromValue, aimValue, current, total));

            case Ease.OutQuad:
                return(TweenMath.OutQuad(fromValue, aimValue, current, total));

            case Ease.InoutQuad:
                return(TweenMath.InoutQuad(fromValue, aimValue, current, total));

            case Ease.InCubic:
                return(TweenMath.InCubic(fromValue, aimValue, current, total));

            case Ease.OutCubic:
                return(TweenMath.OutCubic(fromValue, aimValue, current, total));

            case Ease.InoutCubic:
                return(TweenMath.InoutCubic(fromValue, aimValue, current, total));

            case Ease.InQuart:
                return(TweenMath.InQuart(fromValue, aimValue, current, total));

            case Ease.OutQuart:
                return(TweenMath.OutQuart(fromValue, aimValue, current, total));

            case Ease.InOutQuart:
                return(TweenMath.InOutQuart(fromValue, aimValue, current, total));

            case Ease.OutInQuart:
                return(TweenMath.OutInQuart(fromValue, aimValue, current, total));

            case Ease.InQuint:
                return(TweenMath.InQuint(fromValue, aimValue, current, total));

            case Ease.OutQuint:
                return(TweenMath.OutQuint(fromValue, aimValue, current, total));

            case Ease.InOutQuint:
                return(TweenMath.InOutQuint(fromValue, aimValue, current, total));

            case Ease.OutInQuint:
                return(TweenMath.OutInQuint(fromValue, aimValue, current, total));

            case Ease.InSine:
                return(TweenMath.InSine(fromValue, aimValue, current, total));

            case Ease.OutSine:
                return(TweenMath.OutSine(fromValue, aimValue, current, total));

            case Ease.InOutSine:
                return(TweenMath.InOutSine(fromValue, aimValue, current, total));

            case Ease.OutInSine:
                return(TweenMath.OutInSine(fromValue, aimValue, current, total));

            case Ease.InExpo:
                return(TweenMath.InExpo(fromValue, aimValue, current, total));

            case Ease.OutExpo:
                return(TweenMath.OutExpo(fromValue, aimValue, current, total));

            case Ease.InOutExpo:
                return(TweenMath.InOutExpo(fromValue, aimValue, current, total));

            case Ease.OutInExpo:
                return(TweenMath.OutInExpo(fromValue, aimValue, current, total));

            case Ease.InBounce:
                return(TweenMath.InBounce(fromValue, aimValue, current, total));

            case Ease.OutBounce:
                return(TweenMath.OutBounce(fromValue, aimValue, current, total));

            case Ease.InOutBounce:
                return(TweenMath.InOutBounce(fromValue, aimValue, current, total));

            case Ease.OutInBounce:
                return(TweenMath.OutInBounce(fromValue, aimValue, current, total));

            case Ease.Default:
                return(curve.Evaluate(current / total) * (aimValue - fromValue) + fromValue);

            // 线性
            default:
                return(Mathf.Lerp(fromValue, aimValue, current / total));
            }
        }