Ejemplo n.º 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;
        }
    }
Ejemplo n.º 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
                );
        }
    }
Ejemplo n.º 3
0
    void Update()
    {
        FunctionLibrary.Function f = FunctionLibrary.GetFunction(function);



        float time = Time.time;

        for (int i = 0; i < points.Length; i++)
        {
            Transform point    = points[i];
            Vector3   position = point.localPosition;

            if (Invert == 0)
            {
                position.x += (speed * Time.deltaTime);
            }
            else
            {
                position.x -= (speed * Time.deltaTime);
            }

            position.y = f(position.x, time);

            point.localPosition = position;
        }
    }
Ejemplo n.º 4
0
    private void AnimatingGraph()
    {
        FunctionLibrary.Function f = FunctionLibrary.GetFunction(functions);

        float time = Time.time;

        for (int i = 0; i < points.Length; i++)
        {
            Transform point    = points[i];
            Vector3   position = point.localPosition;



            point.localPosition = position;
        }
    }
Ejemplo n.º 5
0
    private void Update()
    {
        // the function and current time
        FunctionLibrary.Function f = FunctionLibrary.GetFunction(function);
        float time = Time.time;

        // Animating Points
        for (int i = 0; i < points.Length; i++)
        {
            Transform point = points[i];

            Vector3 position = point.localPosition;
            position.y = f(position.x, time);

            point.localPosition = position;
        }
    }
Ejemplo n.º 6
0
    private void UpdateFunction()
    {
        FunctionLibrary.Function function = FunctionLibrary.GetFunction(targetFunction);

        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 = function(u, v, time);
            }
        }
    }
Ejemplo n.º 7
0
    void UpdateFunction()
    {
        FunctionLibrary.Function f = FunctionLibrary.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);
        }
    }
Ejemplo n.º 8
0
    void UpdateFunction()
    {
        FunctionLibrary.Function func = FunctionLibrary.GetFunction(functionName);
        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 = func(u, v, t);
        }
    }
Ejemplo n.º 9
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);
            }
        }
    }
Ejemplo n.º 10
0
    void UpdateFunction()
    {
        // delegate based on enum selection
        FunctionLibrary.Function f = FunctionLibrary.GetFunction(function);
        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 = f(u, v, time);
        }
    }
Ejemplo n.º 11
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);
        }
    }