예제 #1
0
    void UpdateFunctionTransition()
    {
        FunctionLibrary.Function
            from       = FunctionLibrary.GetFunction(transitionFunction),
            to         = FunctionLibrary.GetFunction(function);
        float progress = duration / transitionDuration;
        float time     = Time.time;
        float step     = 2f / resolution;
        float v        = 0.5f * step - 1f;

        for (int i = 0, x = 0, z = 0; i < points.Length; i++, x++)
        {
            if (x == resolution)
            {
                x  = 0;
                z += 1;
                v  = (z + 0.5f) * step - 1f;
            }
            float u = (x + 0.5f) * step - 1f;

            points[i].localPosition = FunctionLibrary.Morph(
                u, v, time, from, to, progress
                ) * range;
        }
    }
예제 #2
0
    void UpdateFunctionTransition()
    {
        FunctionLibrary.Function
            from       = FunctionLibrary.GetFunction(transitionFunction),
            to         = FunctionLibrary.GetFunction(function);
        float progress = duration / transitionDuration;
        float time     = Time.time;
        float step     = 2f / resolution;
        // uv space added so that we're not confined in 3 coordinates (Sphere, Torus)
        float v = 0.5f * step - 1f;

        for (int i = 0, x = 0, z = 0; i < points.Length; i++, x++)
        {
            if (x == resolution)
            {
                x  = 0;
                z += 1;
                v  = (z + 0.5f) * step - 1f;
            }
            float u = (x + 0.5f) * step - 1f;
            points[i].localPosition = FunctionLibrary.Morph(
                u, v, time, from, to, progress
                );
        }
    }
예제 #3
0
    void UpdateFunctionTransition()
    {
        var from = FunctionLibrary.GetFunction(transitionFunction);
        var to   = FunctionLibrary.GetFunction(function);

        var progress = duration / transitionDuration;

        var time = Time.time;
        var step = 2f / resolution;

        var v = 0.5f * step - 1f;

        for (int i = 0, x = 0, z = 0; i < points.Length; ++i, ++x)
        {
            if (x == resolution)
            {
                x = 0;
                ++z;
                v = (z + 0.5f) * step - 1f;
            }

            var u = (x + 0.5f) * step - 1f;

            points[i].localPosition = FunctionLibrary.Morph(u, v, time, from, to, progress);
        }
    }
예제 #4
0
    private void UpdateFunctionTransition()
    {
        // get from and to function
        FunctionLibrary.Function3D from = FunctionLibrary.GetFunction3D(transitionFunction);
        FunctionLibrary.Function3D to   = FunctionLibrary.GetFunction3D(function);

        // Get Progress
        float progress = duration / transitionDuration;

        float time = Time.time;
        float step = 2f / resolution;
        float v    = 0.5f * step - 1f;

        // Animating Points
        for (int i = 0, x = 0, z = 0; i < points.Length; i++, x++)
        {
            if (x == resolution)
            {
                x  = 0;
                z += 1;
                v  = (z + 0.5f) * step - 1f;
            }
            float u = (x + 0.5f) * step - 1f;

            points[i].localPosition = FunctionLibrary.Morph(
                u, v, time, from, to, progress);
        }
    }
예제 #5
0
    private void UpdateFunctionTransition()
    {
        FunctionLibrary.Function from = FunctionLibrary.GetFunction(transitionFunction);
        FunctionLibrary.Function to   = FunctionLibrary.GetFunction(targetFunction);
        float progress = duration / transitionDuration;

        float time  = Time.time;
        int   index = 0;
        float step  = 2.0f / resolution;

        for (int x = 0; x != resolution; ++x)
        {
            for (int z = 0; z != resolution; ++z)
            {
                float u = (x + 0.5f) * step - 1f;
                float v = (z + 0.5f) * step - 1f;
                points[index++].localPosition = FunctionLibrary.Morph(u, v, time, from, to, progress);
            }
        }
    }
예제 #6
0
    void UpdateFunctionTransition()
    {
        FunctionLibrary.Function from = FunctionLibrary.GetFunction(transitionFromFunc);
        FunctionLibrary.Function to   = FunctionLibrary.GetFunction(functionName);
        float progress = duration / transitionDuration;
        float t        = Time.time;
        float step     = 2f / resolution;
        float v        = .5f * step - 1f;

        for (int i = 0, x = 0, z = 0; i < points.Length; i++, x++)
        {
            if (resolution == x)
            {
                x  = 0;
                z += 1;
                v  = (z + .5f) * step - 1f;
            }
            float u = (x + .5f) * step - 1f;
            points[i].localPosition = FunctionLibrary.Morph(u, v, t, from, to, progress);
        }
    }
예제 #7
0
    private void UpdateFunctionTransition()
    {
        float progress = duration / transitionDuration;
        float time     = Time.time;
        float step     = 2f / resolution;
        float v        = 0.5f * step - 1f;

        for (int i = 0, x = 0, z = 0; i < points.Length; i++, x++)
        {
            if (x == resolution)
            {
                x  = 0;
                z += 1;
                v  = (z + 0.5f) * step - 1f;
            }

            float   u            = (x + 0.5f) * step - 1f;
            Vector3 fromFunction = (Vector3)previousFunction.GetFunction(u, v, time);
            Vector3 toFunction   = (Vector3)currentFunction.GetFunction(u, v, time);
            points[i].localPosition = (Vector3)function.Morph(u, v, time, progress, fromFunction, toFunction);
        }
    }