u3d_插件DoTween:(11)颜色和透明度动画

一、步骤
1.新建一个场景(命名为:007_textColorTweens)
2.创建text控件
3.在text底下添加一个脚本组件(add Component -> 命脚本的名字为:textColorTween)
4.编辑脚本
5.动画设置字体颜色、动画设置字体的alpha
二、code

textColorTween

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;

public class TextColorTween : MonoBehaviour {

    // 1.引入命名空间
    // 2.定义属性
    // 3.将当前的text 给属性赋值
    // 使用 DOColor 
    // DOFade 渐影渐变
    private Text text;

    // Use this for initialization
    void Start () {

        text = GetComponent ();
        /*
         * 第一个参数是 : 目标颜色
         * 
        */
//      text.DOColor (Color.red, 2);

// 渐影渐变 
        /**
         * 第一个参数是 是否显示 ,1为显示出来
         * 第二个参数是 执行时间
        */
        text.DOFade(1,3);
    }
    
    // Update is called once per frame
    void Update () {
        
    }
}


11_5.1动画设置字体颜色


u3d_插件DoTween:(11)颜色和透明度动画_第1张图片
11_5.1动画设置字体颜色.gif

11_5.2动画设置字体的alpha


u3d_插件DoTween:(11)颜色和透明度动画_第2张图片
11_5.2动画设置字体的alpha.gif

你可能感兴趣的:(u3d_插件DoTween:(11)颜色和透明度动画)