TintColor渐变

2016-12-15  本文已影响21人  Moment__格调
using System.Collections;
using DG.Tweening;
public class ColorChange : MonoBehaviour {

    private Material mat;
    public float sp = 0.5f;
    void Start()
    {
        mat = GetComponent<MeshRenderer>().material;
    }
    void Update()
    {
        //sp += Time.deltaTime;

        Color col = mat.GetColor("_TintColor");
        col.a = Mathf.Lerp(col.a,0, Time.deltaTime*sp);
        mat.SetColor("_TintColor",col);
    }
}
上一篇 下一篇

猜你喜欢

热点阅读