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; } }
物体来回跳动
时间: 2024-11-07 23:19:09