UGUI(五)动画系统
来源:互联网 发布:电脑桌面设置软件 编辑:程序博客网 时间:2024/04/29 15:00
Unity暂时没有单独给UGUI提供动画系统,用官方的动画系统也能做只是比较麻烦,所以我们有很多选择了。
1.修改NGUI的UITweener在用UGUI上,轻量级动画系统。
2.使用第三方插件入iTween,DoTween,HOTween等。
发现DoTween不错,就试试了。
先来看效果图:
这里用到了位置,旋转,缩放,颜色四个最主要的动画效果,暂时简单写一个例子,以便以后使用时查阅。
下载地址和详细使用说明如下。
下载地址:http://dotween.demigiant.com/download.php
文档地址:http://dotween.demigiant.com/documentation.php
下载之后复制到工程目录,VS引用DOTween.dll,代码引用using
demo代码如下:
- using
UnityEngine; - using
System.Collections; - using
UnityEngine.UI; - using
DG.Tweening; -
- public
class UIFirstAnima : MonoBehaviour - {
-
private Tweener m_pos; -
private Tweener m_rota; -
private Tweener m_scale; -
private Tweener m_color; -
void Start () { -
// 全局初始化 -
DOTween.Init(true, true, LogBehaviour.ErrorsOnly).SetCapacity( 200,10); -
Image image = transform.GetComponent(); -
// 位置 -
m_pos = image.rectTransform.DOMove(new Vector3(Screen.width 0.5f,* Screen.height 0.5f,0),* 1f); -
m_pos.SetEase(Ease.OutCubic); -
m_pos.SetLoops(10,LoopType.Yoyo); -
// 旋转 -
m_rota = image.rectTransform.DORotate(new Vector3( 0,180,0),1); -
m_rota.SetEase(Ease.Linear); -
m_rota.SetLoops(10, LoopType.Yoyo); -
// 缩放 -
m_scale = image.rectTransform.DOScale(new Vector3( 0.6f,0.6f, 1f), 1); -
m_scale.SetEase(Ease.Linear); -
m_scale.SetLoops(10, LoopType.Yoyo); -
// 颜色 -
m_color = image.material.DOColor(new Color(0f,1f,1f, 0.7f),1f); -
m_color.SetEase(Ease.Linear); -
m_color.SetLoops(10, LoopType.Yoyo); -
// 注册开始和结束事件 -
m_pos.OnStart(AnimaStart); -
m_pos.OnComplete(AnimaEnd); -
} -
private void AnimaStart() -
{ -
Debug.Log("动画开始"); -
} -
private void AnimaEnd() -
{ -
Debug.Log("动画结束"); -
} - }
0 0
- UGUI(五)动画系统
- UGUI--背包系统之五--------Tootip
- Unity3D自学笔记——UGUI背包系统(五)沿用Attribute设计实现物品等级
- UGUI背包系统(初级)
- UGUI背包系统(中)
- UGUI背包系统(下)
- UGUI(一)序列图,表情动画
- 【Unity3d】UGUI 之 Animator, Animation 动画系统学习笔记
- 【Unity3d】UGUI 之 Animator, Animation 动画系统学习笔记
- Unity_UGUI(五)_动画系统
- UGUI逐帧动画
- UGUI实现帧动画
- UGUI序列帧动画
- UGUI序列帧动画
- UGUI动画效果
- UGUI(四)事件系统的封装
- UGUI(四)事件系统的封装
- UGUI的背包系统(上)
- undefined reference to `clock_gettime' 链接错误问题解决
- 转载--《怎样制作一款优秀的塔防游戏》
- 程序员最该看的30本书---------------------------国外编辑推荐
- C#中的委托和事件
- httpClient访问http的rest接口
- UGUI(五)动画系统
- 使用list.all(list1),如何在页面使用c:forEach遍历?
- 数据持久化方案
- lxc源码-- 序
- 在美国折腾护照的一星期
- maven中央仓库地址收集
- 关于VisualSVN和Tortoise的使用
- 使用NPAPI开发Fireforx/Chrome插件
- 笔试题:把一串字符串中单词逆序