Example #1
0
    void UpdateFunctionTransition()
    {
        FunctionLibaray.Function
            from = FunctionLibaray.GetFunction(transitionFunction),
            to   = FunctionLibaray.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 = FunctionLibaray.Morph(u, v, time, from, to, progress);
        }
    }
Example #2
0
    void UpdateFunction()
    {
        FunctionLibaray.Function f = FunctionLibaray.GetFunction(function);

        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 = f(u, v, time);
        }
    }