Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class CongratulatonsScript : MonoBehaviour {
- List<GameObject> eventsList = new List<GameObject>();
- void Start () {
- StartCoroutine(FadeTo(0.0f, 1.0f));
- }
- // Update is called once per frame
- void Update () {
- }
- IEnumerator FadeTo(float aValue, float aTime)
- {
- GameObject strin = eventsList[0];
- float alpha = GetComponent<Text>().material.color.a;
- Material material = GetComponent<Text>().material;
- for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime)
- {
- Color newColor = new Color(material.color.r, material.color.g, material.color.b, Mathf.Lerp(alpha, 0, t));
- GetComponent<Text>().material.color = newColor;
- transform.Translate(Vector3.up * t * 2);
- yield return null;
- }
- // yield return new WaitForSeconds((float)0.5);
- // for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime)
- // {
- // Color newColor = new Color(material.color.r, material.color.g, material.color.b, Mathf.Lerp(alpha, 0, t));
- // GetComponent<Text>().material.color = newColor;
- // transform.Translate(Vector3.up * t * 2);
- // yield return null;
- // }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement