コード例 #1
0
        /// <summary>
        /// Interpolate the specified t by InterpolationMode mode.
        /// </summary>
        /// <param name='t'>
        /// T.
        /// </param>
        /// <param name='mode'>
        /// InterpolationMode.
        /// </param>
        public static float Float(float t, InterpolationMode mode)
        {
            float interpT = 0;

            switch (mode)
            {
            case InterpolationMode.None:
                interpT = Interp.None(t, 0, 1);
                break;

            case InterpolationMode.InOutCubic:
                interpT = Interp.InOutCubic(t, 0, 1);
                break;

            case InterpolationMode.InOutQuintic:
                interpT = Interp.InOutQuintic(t, 0, 1);
                break;

            case InterpolationMode.InQuintic:
                interpT = Interp.InQuintic(t, 0, 1);
                break;

            case InterpolationMode.InQuartic:
                interpT = Interp.InQuartic(t, 0, 1);
                break;

            case InterpolationMode.InCubic:
                interpT = Interp.InCubic(t, 0, 1);
                break;

            case InterpolationMode.InQuadratic:
                interpT = Interp.InQuadratic(t, 0, 1);
                break;

            case InterpolationMode.OutQuintic:
                interpT = Interp.OutQuintic(t, 0, 1);
                break;

            case InterpolationMode.OutQuartic:
                interpT = Interp.OutQuartic(t, 0, 1);
                break;

            case InterpolationMode.OutCubic:
                interpT = Interp.OutCubic(t, 0, 1);
                break;

            case InterpolationMode.OutInCubic:
                interpT = Interp.OutInCubic(t, 0, 1);
                break;

            case InterpolationMode.OutInQuartic:
                interpT = Interp.OutInCubic(t, 0, 1);
                break;

            case InterpolationMode.BackInCubic:
                interpT = Interp.BackInCubic(t, 0, 1);
                break;

            case InterpolationMode.BackInQuartic:
                interpT = Interp.BackInQuartic(t, 0, 1);
                break;

            case InterpolationMode.OutBackCubic:
                interpT = Interp.OutBackCubic(t, 0, 1);
                break;

            case InterpolationMode.OutBackQuartic:
                interpT = Interp.OutBackQuartic(t, 0, 1);
                break;

            case InterpolationMode.OutElasticSmall:
                interpT = Interp.OutElasticSmall(t, 0, 1);
                break;

            case InterpolationMode.OutElasticBig:
                interpT = Interp.OutElasticBig(t, 0, 1);
                break;

            case InterpolationMode.InElasticSmall:
                interpT = Interp.InElasticSmall(t, 0, 1);
                break;

            case InterpolationMode.InElasticBig:
                interpT = Interp.InElasticBig(t, 0, 1);
                break;

            case InterpolationMode.InSine:
                interpT = Interp.InSine(t, 0, 1);
                break;

            case InterpolationMode.OutSine:
                interpT = Interp.OutSine(t, 0, 1);
                break;

            case InterpolationMode.InOutSine:
                interpT = Interp.InOutSine(t, 0, 1);
                break;

            case InterpolationMode.InElastic:
                interpT = Interp.OutElastic(t, 0, 1);
                break;

            case InterpolationMode.OutElastic:
                interpT = Interp.OutElastic(t, 0, 1);
                break;

            case InterpolationMode.InBack:
                interpT = Interp.InBack(t, 0, 1);
                break;

            case InterpolationMode.OutBack:
                interpT = Interp.OutBack(t, 0, 1);
                break;

            default: interpT = 0;
                break;
            }

            return(interpT);
        }
コード例 #2
0
        public static float Float(float t, InterpolationMode mode)
        {
            float result;

            switch (mode)
            {
            case InterpolationMode.None:
                result = Interp.None(t, 0f, 1f);
                break;

            case InterpolationMode.InOutCubic:
                result = Interp.InOutCubic(t, 0f, 1f);
                break;

            case InterpolationMode.InOutQuintic:
                result = Interp.InOutQuintic(t, 0f, 1f);
                break;

            case InterpolationMode.InOutSine:
                result = Interp.InOutSine(t, 0f, 1f);
                break;

            case InterpolationMode.InQuintic:
                result = Interp.InQuintic(t, 0f, 1f);
                break;

            case InterpolationMode.InQuartic:
                result = Interp.InQuartic(t, 0f, 1f);
                break;

            case InterpolationMode.InCubic:
                result = Interp.InCubic(t, 0f, 1f);
                break;

            case InterpolationMode.InQuadratic:
                result = Interp.InQuadratic(t, 0f, 1f);
                break;

            case InterpolationMode.InElastic:
                result = Interp.OutElastic(t, 0f, 1f);
                break;

            case InterpolationMode.InElasticSmall:
                result = Interp.InElasticSmall(t, 0f, 1f);
                break;

            case InterpolationMode.InElasticBig:
                result = Interp.InElasticBig(t, 0f, 1f);
                break;

            case InterpolationMode.InSine:
                result = Interp.InSine(t, 0f, 1f);
                break;

            case InterpolationMode.InBack:
                result = Interp.InBack(t, 0f, 1f);
                break;

            case InterpolationMode.OutQuintic:
                result = Interp.OutQuintic(t, 0f, 1f);
                break;

            case InterpolationMode.OutQuartic:
                result = Interp.OutQuartic(t, 0f, 1f);
                break;

            case InterpolationMode.OutCubic:
                result = Interp.OutCubic(t, 0f, 1f);
                break;

            case InterpolationMode.OutInCubic:
                result = Interp.OutInCubic(t, 0f, 1f);
                break;

            case InterpolationMode.OutInQuartic:
                result = Interp.OutInCubic(t, 0f, 1f);
                break;

            case InterpolationMode.OutElastic:
                result = Interp.OutElastic(t, 0f, 1f);
                break;

            case InterpolationMode.OutElasticSmall:
                result = Interp.OutElasticSmall(t, 0f, 1f);
                break;

            case InterpolationMode.OutElasticBig:
                result = Interp.OutElasticBig(t, 0f, 1f);
                break;

            case InterpolationMode.OutSine:
                result = Interp.OutSine(t, 0f, 1f);
                break;

            case InterpolationMode.OutBack:
                result = Interp.OutBack(t, 0f, 1f);
                break;

            case InterpolationMode.OutBackCubic:
                result = Interp.OutBackCubic(t, 0f, 1f);
                break;

            case InterpolationMode.OutBackQuartic:
                result = Interp.OutBackQuartic(t, 0f, 1f);
                break;

            case InterpolationMode.BackInCubic:
                result = Interp.BackInCubic(t, 0f, 1f);
                break;

            case InterpolationMode.BackInQuartic:
                result = Interp.BackInQuartic(t, 0f, 1f);
                break;

            default:
                result = 0f;
                break;
            }
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// Interpolate between two verctors by InterpolationMode mode
        /// </summary>
        public static Vector3 V3(Vector3 v1, Vector3 v2, float t, InterpolationMode mode)
        {
            float interpT = Interp.Float(t, mode);

            return(((1 - interpT) * v1) + (interpT * v2));
        }
コード例 #4
0
        public static Vector3 V3(Vector3 v1, Vector3 v2, float t, InterpolationMode mode)
        {
            float num = Interp.Float(t, mode);

            return((1f - num) * v1 + num * v2);
        }