blob: 912bf23dd191a61cf8a51f8daba6d2fea9527479 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
using System;
using UnityEngine;
public class CrossFadeImages : MonoBehaviour
{
public SpriteRenderer Image1;
public SpriteRenderer Image2;
public float Period = 5f;
private void Update()
{
Color white = Color.white;
white.a = Mathf.Clamp((Mathf.Sin(3.1415927f * Time.time / this.Period) + 0.75f) * 0.75f, 0f, 1f);
this.Image1.color = white;
white.a = 1f - white.a;
this.Image2.color = white;
}
}
|