DoTween基本使用


 

 

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

public class DoTweenTest : MonoBehaviour {
    public RectTransform rt;
    private bool isIn = false;

    // Use this for initialization  
    void Start()
    {
        //修改的是世界坐標  
        //Tweener t = rt.DOMove(Vector3.zero, 0.3f);  
        //修改的是局部坐標  
        Tweener t = rt.DOLocalMove(Vector3.zero, 0.3f);
        //默認動畫播放完成會自動銷毀  
        t.SetAutoKill(false);
        t.Pause();
    }

    public void OnClick()
    {
        if (!isIn)
        {
            //將開始該物體的所有Tweener  
            rt.DOPlayForward();
        }
        else
        {
            rt.DOPlayBackwards();
        }
        isIn = !isIn;
    }
}  

  

物體來回跳動

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM