/// <summary> /// 一次来回 /// </summary> private void Repeatedly(Transform from, Transform to) { CacheTransform.localPosition = from.localPosition; CacheTransform.localEulerAngles = from.localEulerAngles; CacheTransform.localScale = from.localScale; CacheTransform.DOLocalMove(to.localPosition, duration).OnComplete(() => CacheTransform.DOLocalMove(from.localPosition, duration)); CacheTransform.DOLocalRotate(to.localEulerAngles, duration, RotateMode.FastBeyond360).OnComplete(() => CacheTransform.DOLocalRotate(from.localEulerAngles, duration)); CacheTransform.DOScale(to.localScale, duration).OnComplete(() => CacheTransform.DOScale(from.localScale, duration)); }
/// <summary> /// 循环 /// </summary> private void Loop(Transform from, Transform to) { CacheTransform.localPosition = from.localPosition; CacheTransform.localEulerAngles = from.localEulerAngles; CacheTransform.localScale = from.localScale; CacheTransform.DOLocalMove(to.localPosition, duration).OnComplete(() => OnFinished(() => Loop(from, to))); CacheTransform.DOLocalRotate(to.localEulerAngles, duration, RotateMode.FastBeyond360).OnComplete(() => OnFinished(() => Loop(from, to))); CacheTransform.DOScale(to.localScale, duration).OnComplete(() => OnFinished(() => Loop(from, to))); }
/// <summary> /// 循环来回 /// </summary> private void PingPong(Vector3 from, Vector3 to) { CacheTransform.DOLocalMove(to, duration).OnComplete(() => PingPong(to, from)); }
/// <summary> /// 一次来回 /// </summary> private void Repeatedly(Vector3 from, Vector3 to) { CacheTransform.localPosition = from; CacheTransform.DOLocalMove(to, duration).OnComplete(() => CacheTransform.DOLocalMove(this.from, duration)); }
/// <summary> /// 循环 /// </summary> private void Loop(Vector3 from, Vector3 to) { CacheTransform.localPosition = from; CacheTransform.DOLocalMove(to, duration).OnComplete(() => Loop(this.from, to)); }
/// <summary> /// 一次 /// </summary> private void Once(Vector3 from, Vector3 to) { CacheTransform.localPosition = from; CacheTransform.DOLocalMove(to, duration).OnComplete(() => onFinished()); }
/// <summary> /// 循环来回 /// </summary> private void PingPong(Transform from, Transform to) { CacheTransform.DOLocalMove(to.localPosition, duration).OnComplete(() => OnFinished(() => PingPong(to, from))); CacheTransform.DOLocalRotate(to.localEulerAngles, duration, RotateMode.FastBeyond360).OnComplete(() => OnFinished(() => PingPong(to, from))); CacheTransform.DOScale(to.localScale, duration).OnComplete(() => OnFinished(() => PingPong(to, from))); }