예제 #1
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);
        }
    }
예제 #2
0
    private void UpdateFunction()
    {
        // the function and current time
        FunctionLibrary.Function3D f = FunctionLibrary.GetFunction3D(function);
        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 = f(u, v, time);
        }
    }