24 lines
573 B
C#
24 lines
573 B
C#
using UnityEngine;
|
|
using DG.Tweening;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
[RequireComponent(typeof(TMP_Text))]
|
|
public class TextBlinker : MonoBehaviour
|
|
{
|
|
public float duration = 0.5f;
|
|
public Ease ease = Ease.InOutSine;
|
|
public float from = 0f;
|
|
public float to = 1f;
|
|
public int loops = -1;
|
|
public LoopType loopType = LoopType.Yoyo;
|
|
|
|
void Start()
|
|
{
|
|
var txt = GetComponent<TMP_Text>();
|
|
var c = txt.color;
|
|
c.a = from;
|
|
txt.color = c;
|
|
txt.DOFade(to, duration).SetEase(ease).SetLoops(loops, loopType);
|
|
}
|
|
}
|