mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-21 01:36:05 +08:00
SetRelative now works with Sequences too (sets all nested tweens as relative)
This commit is contained in:
parent
7b9cb9f7d6
commit
8b77246cfc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -16,6 +16,6 @@ public class Jump : BrainBase
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
target.DOJump(jump, jumpHeight, numJumps, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo);
|
||||
target.DOJump(jump, jumpHeight, numJumps, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetRelative();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -7,15 +7,17 @@ using DG.Tweening.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TempTests : MonoBehaviour
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public bool straightFixedUpdate;
|
||||
public Transform trans;
|
||||
public Renderer rend;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
Tween t = transform.DORotate(new Vector3(0, 180, 0), 2).OnComplete(()=> Debug.Log("Complete"));
|
||||
if (straightFixedUpdate) t.SetUpdate(UpdateType.Fixed);
|
||||
DOTween.Sequence()
|
||||
.Append(rend.material.DOFade(0, 0.5f))
|
||||
.Append(rend.material.DOFade(1, 1f));
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -163,6 +163,12 @@ namespace DG.Tweening
|
||||
s.fullDuration = s.loops > -1 ? s.duration * s.loops : Mathf.Infinity;
|
||||
// Order sequencedObjs by start position
|
||||
s._sequencedObjs.Sort(SortSequencedObjs);
|
||||
// Set relative nested tweens
|
||||
if (s.isRelative) {
|
||||
for (int len = s.sequencedTweens.Count, i = 0; i < len; ++i) {
|
||||
s.sequencedTweens[i].isRelative = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user