BlackImageToLucency.cs 701 B

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. using UnityEngine.UI;
  6. using DG;
  7. using DG.Tweening;
  8. public class BlackImageToLucency : MonoBehaviour
  9. {
  10. private Image backImage = null;
  11. private void Awake()
  12. {
  13. Invoke("LateHide", 1.0f);
  14. backImage = this.GetComponent<Image>();
  15. backImage.color = Color.black;
  16. Tween bgTween1 = backImage.DOColor(new Color(0, 0, 0, 1), 1.0f);
  17. bgTween1.OnComplete(() =>
  18. {
  19. backImage.DOColor(new Color(0, 0, 0, 0), 1.0f);
  20. });
  21. }
  22. private void LateHide()
  23. {
  24. backImage.color = new Color(0, 0, 0, 0);
  25. }
  26. }