Created
May 17, 2015 21:10
-
-
Save unitycoder/dd464da0f0ffe5041e46 to your computer and use it in GitHub Desktop.
Revisions
-
unitycoder revised this gist
May 17, 2015 . 1 changed file with 0 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,14 +4,8 @@ public class ColorFader : MonoBehaviour { public float delay = 2; void Start () { StartCoroutine(Fade(delay)); } @@ -25,8 +19,6 @@ IEnumerator Fade(float duration) comp.color = Color.Lerp(Color.black,Color.clear,timer/duration); yield return 0; } } } -
unitycoder created this gist
May 17, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ using UnityEngine; using System.Collections; using UnityEngine.UI; public class ColorFader : MonoBehaviour { public float delay = 2; void Awake() { GetComponent<Image>().enabled = true; } void Start () { StartCoroutine(Fade(delay)); } IEnumerator Fade(float duration) { var comp = GetComponent<Image>(); for (float timer = 0; timer < duration; timer += Time.deltaTime) { //Debug.Log(timer/duration); comp.color = Color.Lerp(Color.black,Color.clear,timer/duration); yield return 0; } gameObject.SetActive(false); } }