using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Fader_a : MonoBehaviour {
public float speed = 0.2f;
float starttime;
// Use this for initialization
void Start () {
starttime = Time.time;
}
// Update is called once per frame
void Update () {
Color mycolor = gameObject.GetComponent<RawImage>().color;
mycolor.a = Mathf.Lerp(0, 1, (Time.time - starttime) * speed);
gameObject.GetComponent<RawImage>().color = mycolor;
}
}
在Unity中如何使用Mathf.Lerp使图片逐渐透明
最新推荐文章于 2022-03-28 19:02:02 发布