diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll
index 61c197b..905b1ff 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb
index f62a353..92a87fc 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll
index ed50884..b1e69ab 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb
index f04d3aa..d379f64 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll
index 77e4f9d..fd21943 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb
index 64aa913..41d8231 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll
index 6e54739..99b2a11 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb
index 7c7c347..48ed5e3 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll
index 1f88490..148ec92 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb
index ac6e388..b811b10 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll
index 61c197b..905b1ff 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb
index f62a353..92a87fc 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll
index ed50884..b1e69ab 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb
index f04d3aa..d379f64 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll
index 77e4f9d..fd21943 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb
index 64aa913..41d8231 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll
index 6e54739..99b2a11 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb
index 7c7c347..48ed5e3 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll
index 1f88490..148ec92 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb
index ac6e388..b811b10 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll
index 61c197b..905b1ff 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb
index f62a353..92a87fc 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll
index ed50884..b1e69ab 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb
index f04d3aa..d379f64 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll
index 77e4f9d..fd21943 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb
index 64aa913..41d8231 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll
index 6e54739..99b2a11 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb
index 7c7c347..48ed5e3 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll
index 1f88490..148ec92 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb
index ac6e388..b811b10 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/_Tests/Jump.cs b/UnityTests.Unity5/Assets/_Tests/Jump.cs
index e85e9de..cb528d2 100644
--- a/UnityTests.Unity5/Assets/_Tests/Jump.cs
+++ b/UnityTests.Unity5/Assets/_Tests/Jump.cs
@@ -11,11 +11,13 @@ public class Jump : BrainBase
public float duration = 1;
public Ease ease = Ease.OutQuad;
public int loops = -1;
+ public bool isRelative;
IEnumerator Start()
{
yield return new WaitForSeconds(1);
- target.DOJump(jump, jumpHeight, numJumps, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetRelative();
+ Tween t = target.DOJump(jump, jumpHeight, numJumps, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo);
+ if (isRelative) t.SetRelative();
}
}
\ No newline at end of file
diff --git a/UnityTests.Unity5/Assets/_Tests/Jump.unity b/UnityTests.Unity5/Assets/_Tests/Jump.unity
index 2950112..91c1efd 100644
Binary files a/UnityTests.Unity5/Assets/_Tests/Jump.unity and b/UnityTests.Unity5/Assets/_Tests/Jump.unity differ
diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs
index 0078bb4..85527cc 100644
--- a/_DOTween.Assembly/DOTween/DOTween.cs
+++ b/_DOTween.Assembly/DOTween/DOTween.cs
@@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// DOTween's version
- public static readonly string Version = "1.0.790";
+ public static readonly string Version = "1.0.800";
///////////////////////////////////////////////
// Options ////////////////////////////////////
diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ControlPoint.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ControlPoint.cs
index 773d7f4..b9026f8 100644
--- a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ControlPoint.cs
+++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/ControlPoint.cs
@@ -22,5 +22,10 @@ namespace DG.Tweening.Plugins.Core.PathCore
this.a = a;
this.b = b;
}
+
+ public static ControlPoint operator +(ControlPoint cp, Vector3 v)
+ {
+ return new ControlPoint(cp.a + v, cp.b + v);
+ }
}
}
\ No newline at end of file
diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs
index 3059bdb..efef441 100644
--- a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs
+++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs
@@ -31,6 +31,8 @@ namespace DG.Tweening.Plugins.Core.PathCore
[SerializeField] internal float[] timesTable; // Connected to lengthsTable, used for constant speed calculations
[SerializeField] internal float[] lengthsTable; // Connected to timesTable, used for constant speed calculations
internal int linearWPIndex = -1; // Waypoint towards which we're moving (only stored for linear paths, when calling GetPoint)
+ Path _incrementalClone; // Last incremental clone. Stored in case of incremental loops, to avoid recreating a new path every time
+ int _incrementalIndex = 0;
ABSPathDecoder _decoder;
@@ -59,6 +61,11 @@ namespace DG.Tweening.Plugins.Core.PathCore
if (DOTween.isUnityEditor) DOTween.GizmosDelegates.Add(Draw);
}
+ internal Path()
+ {
+ // Used when cloning it
+ }
+
// Needs to be called once waypoints and decoder are assigned, to setup or refresh path data.
internal void FinalizePath(bool isClosedPath, AxisConstraint lockPositionAxes, Vector3 currTargetVal)
{
@@ -181,6 +188,52 @@ namespace DG.Tweening.Plugins.Core.PathCore
isFinalized = false;
}
+ // Clones this path with the given loop increment
+ internal Path CloneIncremental(int loopIncrement)
+ {
+ if (_incrementalClone != null) {
+ if (_incrementalIndex == loopIncrement) return _incrementalClone;
+ _incrementalClone.Destroy();
+ }
+
+ int wpsLen = wps.Length;
+ Vector3 diff = wps[wpsLen - 1] - wps[0];
+ Vector3[] incrWps = new Vector3[wps.Length];
+ for (int i = 0; i < wpsLen; ++i) incrWps[i] = wps[i] + (diff * loopIncrement);
+
+ int cpsLen = controlPoints.Length;
+ ControlPoint[] incrCps = new ControlPoint[cpsLen];
+ for (int i = 0; i < cpsLen; ++i) incrCps[i] = controlPoints[i] + (diff * loopIncrement);
+
+ Vector3[] incrNonLinearDrawWps = null;
+ if (nonLinearDrawWps != null) {
+ int nldLen = nonLinearDrawWps.Length;
+ incrNonLinearDrawWps = new Vector3[nldLen];
+ for (int i = 0; i < nldLen; ++i) incrNonLinearDrawWps[i] = nonLinearDrawWps[i] + (diff * loopIncrement);
+ }
+
+ _incrementalClone = new Path();
+ _incrementalIndex = loopIncrement;
+ _incrementalClone.type = type;
+ _incrementalClone.subdivisionsXSegment = subdivisionsXSegment;
+ _incrementalClone.subdivisions = subdivisions;
+ _incrementalClone.wps = incrWps;
+ _incrementalClone.controlPoints = incrCps;
+ if (DOTween.isUnityEditor) DOTween.GizmosDelegates.Add(_incrementalClone.Draw);
+
+ _incrementalClone.length = length;
+ _incrementalClone.wpLengths = wpLengths;
+ _incrementalClone.timesTable = timesTable;
+ _incrementalClone.lengthsTable = lengthsTable;
+ _incrementalClone._decoder = _decoder;
+ _incrementalClone.nonLinearDrawWps = incrNonLinearDrawWps;
+ _incrementalClone.targetPosition = targetPosition;
+ _incrementalClone.lookAtPosition = lookAtPosition;
+
+ _incrementalClone.isFinalized = true;
+ return _incrementalClone;
+ }
+
#endregion
// Deletes the previous waypoints and assigns the new ones
diff --git a/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs
index ab95b6f..28ce495 100644
--- a/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs
+++ b/_DOTween.Assembly/DOTween/Plugins/PathPlugin.cs
@@ -102,6 +102,11 @@ namespace DG.Tweening.Plugins
public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter getter, DOSetter setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{
+ if (t.loopType == LoopType.Incremental && !options.isClosedPath) {
+ int increment = (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
+ if (increment > 0) changeValue = changeValue.CloneIncremental(increment);
+ }
+
float pathPerc = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
float constantPathPerc = changeValue.ConvertToConstantPathPerc(pathPerc);
Vector3 newPos = changeValue.GetPoint(constantPathPerc);
diff --git a/_DOTween.Assembly/DOTween/Sequence.cs b/_DOTween.Assembly/DOTween/Sequence.cs
index de03ac4..e5c6b56 100644
--- a/_DOTween.Assembly/DOTween/Sequence.cs
+++ b/_DOTween.Assembly/DOTween/Sequence.cs
@@ -166,7 +166,8 @@ namespace DG.Tweening
// Set relative nested tweens
if (s.isRelative) {
for (int len = s.sequencedTweens.Count, i = 0; i < len; ++i) {
- s.sequencedTweens[i].isRelative = true;
+ Tween t = s.sequencedTweens[i];
+ if (!s.isBlendable) s.sequencedTweens[i].isRelative = true;
}
}
return true;
diff --git a/_DOTween.Assembly/DOTween/ShortcutExtensions.cs b/_DOTween.Assembly/DOTween/ShortcutExtensions.cs
index 87e45f2..77da952 100644
--- a/_DOTween.Assembly/DOTween/ShortcutExtensions.cs
+++ b/_DOTween.Assembly/DOTween/ShortcutExtensions.cs
@@ -439,7 +439,9 @@ namespace DG.Tweening
public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
- float offsetY = endValue.y - target.position.y;
+ float startPosY = target.position.y;
+ float offsetY = -1;
+ bool offsetYSet = false;
Sequence s = DOTween.Sequence()
#if COMPATIBLE
.Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(endValue.x, 0, 0), duration)
@@ -459,9 +461,13 @@ namespace DG.Tweening
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
#endif
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
- .SetLoops(numJumps * 2, LoopType.Yoyo)
+ .SetLoops(numJumps * 2, LoopType.Yoyo).SetRelative()
).SetTarget(target).SetEase(DOTween.defaultEaseType);
s.OnUpdate(() => {
+ if (!offsetYSet) {
+ offsetYSet = false;
+ offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
+ }
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.MovePosition(pos);
@@ -794,17 +800,23 @@ namespace DG.Tweening
public static Sequence DOJump(this Transform target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
- float offsetY = endValue.y - target.position.y;
+ float startPosY = target.position.y;
+ float offsetY = -1;
+ bool offsetYSet = false;
Sequence s = DOTween.Sequence()
.Append(DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
- .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
+ .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
).SetTarget(target).SetEase(DOTween.defaultEaseType);
s.OnUpdate(() => {
+ if (!offsetYSet) {
+ offsetYSet = false;
+ offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
+ }
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.position = pos;
@@ -822,17 +834,23 @@ namespace DG.Tweening
public static Sequence DOLocalJump(this Transform target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
- float offsetY = endValue.y - target.localPosition.y;
+ float startPosY = target.localPosition.y;
+ float offsetY = -1;
+ bool offsetYSet = false;
Sequence s = DOTween.Sequence()
.Append(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
- .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
+ .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
).SetTarget(target).SetEase(DOTween.defaultEaseType);
s.OnUpdate(() => {
+ if (!offsetYSet) {
+ offsetYSet = false;
+ offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
+ }
Vector3 pos = target.localPosition;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.localPosition = pos;
diff --git a/_DOTween.Assembly/DOTween/TweenExtensions.cs b/_DOTween.Assembly/DOTween/TweenExtensions.cs
index 9022b2d..7217807 100644
--- a/_DOTween.Assembly/DOTween/TweenExtensions.cs
+++ b/_DOTween.Assembly/DOTween/TweenExtensions.cs
@@ -449,7 +449,7 @@ namespace DG.Tweening
}
float perc = t.position / t.duration;
- bool isInverse = t.completedLoops > 0 && t.loopType == LoopType.Yoyo && t.completedLoops % 2 != 0;
+ bool isInverse = t.completedLoops > 0 && t.loopType == LoopType.Yoyo && (!t.isComplete && t.completedLoops % 2 != 0 || t.isComplete && t.completedLoops % 2 == 0);
return isInverse ? 1 - perc : perc;
}
diff --git a/_DOTween.Assembly/DOTween43/ShortcutExtensions43.cs b/_DOTween.Assembly/DOTween43/ShortcutExtensions43.cs
index 23bde6b..85c367f 100644
--- a/_DOTween.Assembly/DOTween43/ShortcutExtensions43.cs
+++ b/_DOTween.Assembly/DOTween43/ShortcutExtensions43.cs
@@ -102,7 +102,9 @@ namespace DG.Tweening
public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
- float offsetY = endValue.y - target.position.y;
+ float startPosY = target.position.y;
+ float offsetY = -1;
+ bool offsetYSet = false;
Sequence s = DOTween.Sequence()
#if COMPATIBLE
.Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(endValue.x, 0, 0), duration)
@@ -116,9 +118,13 @@ namespace DG.Tweening
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector2(0, jumpPower), duration / (numJumps * 2))
#endif
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
- .SetLoops(numJumps * 2, LoopType.Yoyo)
+ .SetLoops(numJumps * 2, LoopType.Yoyo).SetRelative()
).SetTarget(target).SetEase(DOTween.defaultEaseType);
s.OnUpdate(() => {
+ if (!offsetYSet) {
+ offsetYSet = false;
+ offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
+ }
Vector2 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.MovePosition(pos);
diff --git a/_DOTween.Assembly/DOTween46/ShortcutExtensions46.cs b/_DOTween.Assembly/DOTween46/ShortcutExtensions46.cs
index f23e8ed..a84b14a 100644
--- a/_DOTween.Assembly/DOTween46/ShortcutExtensions46.cs
+++ b/_DOTween.Assembly/DOTween46/ShortcutExtensions46.cs
@@ -261,15 +261,21 @@ namespace DG.Tweening
public static Sequence DOJumpAnchorPos(this RectTransform target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
- float offsetY = endValue.y - target.anchoredPosition.y;
+ float startPosY = target.anchoredPosition.y;
+ float offsetY = -1;
+ bool offsetYSet = false;
Sequence s = DOTween.Sequence()
.Append(DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue.x, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, jumpPower), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
- .SetLoops(numJumps * 2, LoopType.Yoyo)
+ .SetLoops(numJumps * 2, LoopType.Yoyo).SetRelative()
).SetTarget(target).SetEase(DOTween.defaultEaseType);
s.OnUpdate(() => {
+ if (!offsetYSet) {
+ offsetYSet = false;
+ offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
+ }
Vector2 pos = target.anchoredPosition;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.anchoredPosition = pos;
diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll
index 61c197b..905b1ff 100644
Binary files a/_DOTween.Assembly/bin/DOTween.dll and b/_DOTween.Assembly/bin/DOTween.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween.dll.mdb b/_DOTween.Assembly/bin/DOTween.dll.mdb
index f62a353..92a87fc 100644
Binary files a/_DOTween.Assembly/bin/DOTween.dll.mdb and b/_DOTween.Assembly/bin/DOTween.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/DOTween43.dll b/_DOTween.Assembly/bin/DOTween43.dll
index ed50884..b1e69ab 100644
Binary files a/_DOTween.Assembly/bin/DOTween43.dll and b/_DOTween.Assembly/bin/DOTween43.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween43.dll.mdb b/_DOTween.Assembly/bin/DOTween43.dll.mdb
index f04d3aa..d379f64 100644
Binary files a/_DOTween.Assembly/bin/DOTween43.dll.mdb and b/_DOTween.Assembly/bin/DOTween43.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/DOTween46.dll b/_DOTween.Assembly/bin/DOTween46.dll
index 77e4f9d..fd21943 100644
Binary files a/_DOTween.Assembly/bin/DOTween46.dll and b/_DOTween.Assembly/bin/DOTween46.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween46.dll.mdb b/_DOTween.Assembly/bin/DOTween46.dll.mdb
index 64aa913..41d8231 100644
Binary files a/_DOTween.Assembly/bin/DOTween46.dll.mdb and b/_DOTween.Assembly/bin/DOTween46.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/DOTween50.dll b/_DOTween.Assembly/bin/DOTween50.dll
index 6e54739..99b2a11 100644
Binary files a/_DOTween.Assembly/bin/DOTween50.dll and b/_DOTween.Assembly/bin/DOTween50.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween50.dll.mdb b/_DOTween.Assembly/bin/DOTween50.dll.mdb
index 7c7c347..48ed5e3 100644
Binary files a/_DOTween.Assembly/bin/DOTween50.dll.mdb and b/_DOTween.Assembly/bin/DOTween50.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll
index 1f88490..148ec92 100644
Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll differ
diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb
index ac6e388..b811b10 100644
Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb differ