Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. private IEnumerator ImageFadeInOut(Image image, float fadeTime)
  2. {
  3. yield return new WaitForSeconds(fadeTime);
  4. float thisTimer4 = 0;
  5. float adder4 = .01f;
  6. Color newColor4 = image.GetComponent<Image>().color;
  7. while (thisTimer4 < fadeTime)
  8. {
  9. thisTimer4 = thisTimer4 + .01f;
  10. yield return new WaitForSeconds(.01f);
  11. if (thisTimer4 > fadeTime / 2)
  12. {
  13. adder4 = -.01f;
  14. }
  15. newColor4.a += adder4;
  16. image.GetComponent<Image>().color = newColor4;
  17. }
  18. image.gameObject.SetActive(false);
  19. }
  20.  
  21. private IEnumerator FadeInOut(Text text5)
  22. {
  23. float thisTimer5 = 0;
  24. float adder5 = .01f;
  25. Color newColor5 = text5.color;
  26.  
  27. while (thisTimer5 < 3)
  28. {
  29. thisTimer5 = thisTimer5 + .01f;
  30. yield return new WaitForSeconds(.01f);
  31. if (thisTimer5 > 1.5 && adder5 > 0)
  32. {
  33. adder5 = adder5 * (-1);
  34. }
  35. newColor5.a += adder5;
  36. text5.color = newColor5;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement