Files
bansonic_beta_main/Assets/scripts/UI/UI_Show_Anim.cs
T
FloatGaming 1d818fa4eb 整合包
gameplay bundle has been imported together
2025-08-09 18:29:32 +08:00

31 lines
823 B
C#

using DG.Tweening;
using UnityEngine;
public class UI_Show_Anim : MonoBehaviour
{
public float animTime_Alpha = 1f;
public float animTime_Scale = 1f;
private void OnEnable()
{
Clear();
transform.localScale = new();
transform.DOScale(1, animTime_Scale);
gameObject.Try_Get_Component(out CanvasGroup canvasGroup);
float a = 0;
DOTween.To(() => a, (f) => { a = f; canvasGroup.alpha = f; }, 1, animTime_Alpha);
}
public void Close()
{
Clear();
transform.DOScale(0, animTime_Scale);
gameObject.Try_Get_Component(out CanvasGroup canvasGroup);
float a = 1;
DOTween.To(() => a, (f) => { a = f; canvasGroup.alpha = f; }, 0, animTime_Alpha);
}
void Clear()
{
DOTween.KillAll(transform);
}
}