美文网首页unity3d插件
u3d_插件DoTween:(09)对话框文字动画

u3d_插件DoTween:(09)对话框文字动画

作者: liyuhong165 | 来源:发表于2017-04-24 17:56 被阅读238次
一、步骤
1.新建一个场景(命名为:005_textTween)
2.创建一个text
3.创建一个脚本(myText)
4.之前对游戏物体做一个动画 是通过Rect Transform
5.使用Dotween里面的一个方法DOText进行一个文本的动画
(如果原来的text有文字,在动画过程中把原有的文字替换掉)
二、code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; // 引用UI的命名空间
using DG.Tweening;
public class myText : MonoBehaviour {

    private Text text; //文本

    // Use this for initialization
    void Start () {
        text = this.GetComponent<Text> (); // 直接获取游戏物体
        text.DOText("DOText是用来动画显示text的,接下来,开始动画了,效果是一个字一个字显示的",4,);//richtextEnabled 第三个参数是一个富文本
    }
    
    // Update is called once per frame
    void Update () {
        
    }
}


9_1对话框文字动画.gif

相关文章

网友评论

    本文标题:u3d_插件DoTween:(09)对话框文字动画

    本文链接:https://www.haomeiwen.com/subject/upvszttx.html