RawImage logo = mainLogo.transform.FindChild("back/headBack/Logo").GetComponent<RawImage>();

void Update()
{

var r = logo.color.r;
var g = logo.color.g;
var b = logo.color.b;
var alpha = Mathf.PingPong(Time.time / 5f, 1);
logo.color = new Color(r, g, b, alpha);

}

 

//在unity简单使用案例

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class fade : MonoBehaviour
{
  private Image image;
  void Start()
  {
    image = GameObject.Find("Canvas/Image").GetComponent<Image>();
  }

  void Update()
  {
    var r = image.color.r;
    var g = image.color.g;
    var b = image.color.b;
    var alpha = Mathf.PingPong(Time.time / 5f, 1);
    image.color = new Color(r, g, b, alpha);
  }
}

相关文章:

  • 2021-08-18
  • 2022-12-23
  • 2021-12-27
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-16
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-07-08
  • 2021-07-02
相关资源
相似解决方案