using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
public class FontShow1 : MonoBehaviour
{
private string str;
private Text text;
private Tweener tween;
public float duration;
// Start is called before the first frame update
void Awake()
{
text = transform.GetComponent();
str = "u3000u3000"+text.text;
//text.text = "";
//StartCoroutine("Numerator"); //开启协程
transform.GetComponent().DOText("报", 10);
}
private void OnEnable()
{
text.text = "";
tween = text.DOText(str, duration);//文字逐渐显示,时间4秒
tween.SetEase(Ease.Linear);
}
private void OnDisable()
{
tween.Kill();
}
// Update is called once per frame
void Update()
{
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
public class FontShowShu1 : MonoBehaviour
{
private string str;
private Text text;
private Tweener tween;
public float duration;
// Start is called before the first frame update
void Awake ()
{
text = transform.GetComponent();
str = text.text;
//transform.GetComponent().DOText("报", 10);
}
private void OnEnable()
{
//text = GetComponent();
text.text = "";
tween=text.DOText(str, duration);//文字逐渐显示,时间4秒
tween.SetEase(Ease.Linear);
}
private void OnDisable()
{
//StopAllCoroutines();
tween.Kill();
}
// Update is called once per frame
void Update()
{
}
}