Animating Colors

Color animation scripting example.

Color AB

public class ColorAnimationTest : MonoBehaviour
{
    private Color color;

    private void Start()
    {
        // Animate a color from white to black in 1 second
        AnimationCreator.ColorAnimation(Color.white, Color.black, (x) => color = x, 1);
    }
}

Color Array

public class ColorAnimationTest : MonoBehaviour
{
    private Color color;

    private void Start()
    {
        // Animate through all colors in 1 second
        AnimationCreator.ColorAnimation(new Color[] { Color.white, Color.black, Color.red }, (x) => color = x, 1);
    }
}

Last updated