Version: 2017.1

Gradient

class in UnityEngine

Cambiar al Manual

Descripción

Gradiente usado para animar colores.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { Gradient g; GradientColorKey[] gck; GradientAlphaKey[] gak; g = new Gradient(); gck = new GradientColorKey[2]; gck[0].color = Color.red; gck[0].time = 0.0F; gck[1].color = Color.blue; gck[1].time = 1.0F; gak = new GradientAlphaKey[2]; gak[0].alpha = 1.0F; gak[0].time = 0.0F; gak[1].alpha = 0.0F; gak[1].time = 1.0F; g.SetKeys(gck, gak); Debug.Log(g.Evaluate(0.25F)); } }

Note that the alpha and colors keys will be automatically sorted by time value and that it is ensured to always have a minimum of 2 color keys and 2 alpha keys.

Variables

alphaKeysAll alpha keys defined in the gradient.
colorKeysAll color keys defined in the gradient.
modeControl how the gradient is evaluated.

Constructores

GradientCreate a new Gradient object.

Funciones Públicas

EvaluateCalculate color at a given time.
SetKeysSetup Gradient with an array of color keys and alpha keys.