UGUI DOTeen插件

来源:互联网 发布:硕放菜鸟网络招聘 编辑:程序博客网 时间:2024/06/06 04:08
  1. using UnityEngine;  
  2. using System.Collections;  
  3. using UnityEngine.UI;  
  4. using DG.Tweening;   
  5.   
  6. public class UIFirstAnima MonoBehaviour   
  7.  
  8.     private Tweener m_pos;  
  9.     private Tweener m_rota;  
  10.     private Tweener m_scale;  
  11.     private Tweener m_color;  
  12.     void Start ()  
  13.         // 全局初始化  
  14.         DOTween.Init(truetrueLogBehaviour.ErrorsOnly).SetCapacity(20010);  
  15.         Image image transform.GetComponent();  
  16.         // 位置  
  17.         m_pos image.rectTransform.DOMove(new Vector3(Screen.width 0.5f, Screen.height 0.5f,0), 1f);  
  18.         m_pos.SetEase(Ease.OutCubic);  
  19.         m_pos.SetLoops(10,LoopType.Yoyo);  
  20.         // 旋转  
  21.         m_rota image.rectTransform.DORotate(new Vector3(0,180,0), 1);  
  22.         m_rota.SetEase(Ease.Linear);  
  23.         m_rota.SetLoops(10LoopType.Yoyo);  
  24.         // 缩放  
  25.         m_scale image.rectTransform.DOScale(new Vector3(0.6f, 0.6f, 1f), 1);  
  26.         m_scale.SetEase(Ease.Linear);  
  27.         m_scale.SetLoops(10LoopType.Yoyo);  
  28.         // 颜色  
  29.         m_color image.material.DOColor(new Color(0f,1f,1f, 0.7f), 1f);  
  30.         m_color.SetEase(Ease.Linear);  
  31.         m_color.SetLoops(10LoopType.Yoyo);  
  32.         // 注册开始和结束事件  
  33.         m_pos.OnStart(AnimaStart);  
  34.         m_pos.OnComplete(AnimaEnd);  
  35.      
  36.     private void AnimaStart()  
  37.      
  38.         Debug.Log("动画开始");  
  39.      
  40.     private void AnimaEnd()  
  41.      
  42.         Debug.Log("动画结束");  
  43.      
  44.  
0 0
原创粉丝点击