如图动画
using UnityEngine;
using System.Collections;
using DG.Tweening;
public class DoTweenPositionEx : MonoBehaviour {
[SerializeField]
Vector3 from = Vector3.zero;
[SerializeField]
Vector3 to = Vector3.zero;
[SerializeField]
float delay = 0f;
[SerializeField]
Ease type = Ease.OutBack;
[SerializeField]
float time = 0.4f;
void OnEnable()
{
transform.localPosition = from;
StartCoroutine(DoTweening());
}
IEnumerator DoTweening()
{
yield return new WaitForSeconds(delay);
transform.DOLocalMove(to, time).SetEase(type);
}
}