1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00

Added DOLocalJump shortcut

This commit is contained in:
Daniele Giardini 2015-05-15 13:38:42 +02:00
parent f8e882d3a5
commit 6fda9c7767
46 changed files with 60 additions and 1 deletions

View File

@ -1256,6 +1256,15 @@
<param name="duration">The duration of the tween</param> <param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param> <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member> </member>
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
<summary>Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis.
Returns a Sequence instead of a Tweener.
Also stores the transform as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The X/Z end value to reach, and the Y jump height</param>
<param name="numJumps">Total number of jumps</param>
<param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})"> <member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
<summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. <summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm.
Also stores the transform as the tween's target so it can be used for filtered operations</summary> Also stores the transform as the tween's target so it can be used for filtered operations</summary>

View File

@ -1256,6 +1256,15 @@
<param name="duration">The duration of the tween</param> <param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param> <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member> </member>
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
<summary>Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis.
Returns a Sequence instead of a Tweener.
Also stores the transform as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The X/Z end value to reach, and the Y jump height</param>
<param name="numJumps">Total number of jumps</param>
<param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})"> <member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
<summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. <summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm.
Also stores the transform as the tween's target so it can be used for filtered operations</summary> Also stores the transform as the tween's target so it can be used for filtered operations</summary>

View File

@ -1256,6 +1256,15 @@
<param name="duration">The duration of the tween</param> <param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param> <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member> </member>
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
<summary>Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis.
Returns a Sequence instead of a Tweener.
Also stores the transform as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The X/Z end value to reach, and the Y jump height</param>
<param name="numJumps">Total number of jumps</param>
<param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})"> <member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
<summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. <summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm.
Also stores the transform as the tween's target so it can be used for filtered operations</summary> Also stores the transform as the tween's target so it can be used for filtered operations</summary>

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween public class DOTween
{ {
/// <summary>DOTween's version</summary> /// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.715"; public static readonly string Version = "1.0.716";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -801,6 +801,29 @@ namespace DG.Tweening
) )
.SetTarget(target).SetEase(DOTween.defaultEaseType); .SetTarget(target).SetEase(DOTween.defaultEaseType);
} }
/// <summary>Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The X/Z end value to reach, and the Y jump height</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOLocalJump(this Transform target, Vector3 endValue, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
return 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, endValue.y, 0), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
.SetLoops(numJumps * 2, LoopType.Yoyo)
)
.SetTarget(target).SetEase(DOTween.defaultEaseType);
}
/// <summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. /// <summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary> /// Also stores the transform as the tween's target so it can be used for filtered operations</summary>

View File

@ -1256,6 +1256,15 @@
<param name="duration">The duration of the tween</param> <param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param> <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member> </member>
<member name="M:DG.Tweening.ShortcutExtensions.DOLocalJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
<summary>Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis.
Returns a Sequence instead of a Tweener.
Also stores the transform as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The X/Z end value to reach, and the Y jump height</param>
<param name="numJumps">Total number of jumps</param>
<param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})"> <member name="M:DG.Tweening.ShortcutExtensions.DOPath(UnityEngine.Transform,UnityEngine.Vector3[],System.Single,DG.Tweening.PathType,DG.Tweening.PathMode,System.Int32,System.Nullable{UnityEngine.Color})">
<summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. <summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm.
Also stores the transform as the tween's target so it can be used for filtered operations</summary> Also stores the transform as the tween's target so it can be used for filtered operations</summary>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.