Example #1
0
    void Start()
    {
        running = new Interpolation(t => toRotate.transform.rotation = Quaternion.Euler(0, 0, t * 360f))
                  .Duration(duration)
                  .Repeats(true)
                  .Build(this);

        running.Play();
    }
Example #2
0
    void UpdateColor(bool animated)
    {
        Renderer particleRenderer = particles.GetComponent <Renderer>();

        Color from = particleRenderer.material.GetColor(colorKey);
        Color to   = colors[colorIndex];

        System.Action <float> step = t =>
                                     particleRenderer.material.SetColor(colorKey, Color.Lerp(from, to, t));

        if (running != null)
        {
            running.Stop();
        }

        running = new Interpolation(step)
                  .Duration(animated ? transitionDuration : 0)
                  .Build(this);

        running.Play();
    }