LoginSignup
5
4

More than 5 years have passed since last update.

Imageの透明度を動的に変化させる

Last updated at Posted at 2016-10-29

以下のコードを、透明度を動的に変化させたいオブジェクトにアタッチ

//speedは1.0までの値で、大きいほど早く変化
float speed = 0.01f;

void Start () {
        red = GetComponent<Image>().color.r;
        green = GetComponent<Image>().color.g;
        blue = GetComponent<Image>().color.b;
    }

    void Update () {
        GetComponent<Image>().color = new Color(red, green, blue, alfa);
        alfa += speed;  
    }
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4