您的位置:首页 > 移动开发 > Unity3D

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

2017-04-27 00:00 190 查看
#####一、步骤

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> ();
/*
* 第一个参数是 : 目标颜色
*
*/
//		text.DOColor (Color.red, 2);

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

// Update is called once per frame
void Update () {

}
}


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



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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Unity3D DoTween插件