mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2026-02-18 04:51:49 +08:00
Added Transform/RigidBody/2D DOJump shortcut
This commit is contained in:
parent
d70e0055d4
commit
f8e882d3a5
@ -1054,6 +1054,15 @@
|
|||||||
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
||||||
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody 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.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
@ -1238,6 +1247,15 @@
|
|||||||
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
||||||
Setting it to 0 will shake along a single direction.</param>
|
Setting it to 0 will shake along a single direction.</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Transform's X/Z position 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.
@ -43,6 +43,15 @@
|
|||||||
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody2D,UnityEngine.Vector2,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
<param name="endValue">The X 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.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
||||||
<summary>Tweens a SpriteRenderer's color to the given value,
|
<summary>Tweens a SpriteRenderer's color to the given value,
|
||||||
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
||||||
|
|||||||
@ -1054,6 +1054,15 @@
|
|||||||
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
||||||
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody 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.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
@ -1238,6 +1247,15 @@
|
|||||||
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
||||||
Setting it to 0 will shake along a single direction.</param>
|
Setting it to 0 will shake along a single direction.</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Transform's X/Z position 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.
@ -43,6 +43,15 @@
|
|||||||
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody2D,UnityEngine.Vector2,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
<param name="endValue">The X 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.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
||||||
<summary>Tweens a SpriteRenderer's color to the given value,
|
<summary>Tweens a SpriteRenderer's color to the given value,
|
||||||
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
||||||
|
|||||||
@ -1054,6 +1054,15 @@
|
|||||||
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
||||||
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody 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.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
@ -1238,6 +1247,15 @@
|
|||||||
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
||||||
Setting it to 0 will shake along a single direction.</param>
|
Setting it to 0 will shake along a single direction.</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Transform's X/Z position 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.
@ -43,6 +43,15 @@
|
|||||||
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody2D,UnityEngine.Vector2,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
<param name="endValue">The X 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.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
||||||
<summary>Tweens a SpriteRenderer's color to the given value,
|
<summary>Tweens a SpriteRenderer's color to the given value,
|
||||||
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
||||||
|
|||||||
19
UnityTests.Unity5/Assets/_Tests/Jump.cs
Normal file
19
UnityTests.Unity5/Assets/_Tests/Jump.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using DG.Tweening;
|
||||||
|
|
||||||
|
public class Jump : BrainBase
|
||||||
|
{
|
||||||
|
public Transform target;
|
||||||
|
public Vector3 jump = new Vector3(4, 3, 0);
|
||||||
|
public int numJumps = 1;
|
||||||
|
public float duration = 1;
|
||||||
|
public Ease ease = Ease.OutQuad;
|
||||||
|
|
||||||
|
IEnumerator Start()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(1);
|
||||||
|
|
||||||
|
target.DOJump(jump, numJumps, duration).SetEase(ease).SetLoops(-1, LoopType.Yoyo);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
UnityTests.Unity5/Assets/_Tests/Jump.cs.meta
Normal file
12
UnityTests.Unity5/Assets/_Tests/Jump.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bb2397e6cf0716d4e9dbb9693a2348b6
|
||||||
|
timeCreated: 1431530844
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
UnityTests.Unity5/Assets/_Tests/Jump.unity
Normal file
BIN
UnityTests.Unity5/Assets/_Tests/Jump.unity
Normal file
Binary file not shown.
8
UnityTests.Unity5/Assets/_Tests/Jump.unity.meta
Normal file
8
UnityTests.Unity5/Assets/_Tests/Jump.unity.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6b4d9f63e490b11478f87f55566d4f99
|
||||||
|
timeCreated: 1431530833
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -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.710";
|
public static readonly string Version = "1.0.715";
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
@ -426,6 +426,46 @@ namespace DG.Tweening
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Special
|
||||||
|
|
||||||
|
/// <summary>Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
/// Returns a Sequence instead of a Tweener.
|
||||||
|
/// Also stores the Rigidbody 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 DOJump(this Rigidbody target, Vector3 endValue, int numJumps, float duration, bool snapping = false)
|
||||||
|
{
|
||||||
|
if (numJumps < 1) numJumps = 1;
|
||||||
|
return DOTween.Sequence()
|
||||||
|
#if COMPATIBLE
|
||||||
|
.Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(endValue.x, 0, 0), duration)
|
||||||
|
#else
|
||||||
|
.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration)
|
||||||
|
#endif
|
||||||
|
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
||||||
|
)
|
||||||
|
#if COMPATIBLE
|
||||||
|
.Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, 0, endValue.z), duration)
|
||||||
|
#else
|
||||||
|
.Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration)
|
||||||
|
#endif
|
||||||
|
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
|
||||||
|
)
|
||||||
|
#if COMPATIBLE
|
||||||
|
.Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, endValue.y, 0), duration / (numJumps * 2))
|
||||||
|
#else
|
||||||
|
.Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue.y, 0), duration / (numJumps * 2))
|
||||||
|
#endif
|
||||||
|
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
|
||||||
|
.SetLoops(numJumps * 2, LoopType.Yoyo)
|
||||||
|
)
|
||||||
|
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region TrailRenderer Shortcuts
|
#region TrailRenderer Shortcuts
|
||||||
@ -736,6 +776,32 @@ namespace DG.Tweening
|
|||||||
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
|
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Special
|
||||||
|
|
||||||
|
/// <summary>Tweens a Transform's X/Z position 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 DOJump(this Transform target, Vector3 endValue, int numJumps, float duration, bool snapping = false)
|
||||||
|
{
|
||||||
|
if (numJumps < 1) numJumps = 1;
|
||||||
|
return 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, 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>
|
||||||
/// <param name="path">The waypoints to go through</param>
|
/// <param name="path">The waypoints to go through</param>
|
||||||
@ -804,6 +870,8 @@ namespace DG.Tweening
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Blendables
|
#region Blendables
|
||||||
|
|
||||||
#region Light
|
#region Light
|
||||||
|
|||||||
@ -89,6 +89,39 @@ namespace DG.Tweening
|
|||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Special
|
||||||
|
|
||||||
|
/// <summary>Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
/// Returns a Sequence instead of a Tweener.
|
||||||
|
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
/// <param name="endValue">The X 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 DOJump(this Rigidbody2D target, Vector2 endValue, int numJumps, float duration, bool snapping = false)
|
||||||
|
{
|
||||||
|
if (numJumps < 1) numJumps = 1;
|
||||||
|
return DOTween.Sequence()
|
||||||
|
#if COMPATIBLE
|
||||||
|
.Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector2(endValue.x, 0), duration)
|
||||||
|
#else
|
||||||
|
.Append(DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue.x, 0), duration)
|
||||||
|
#endif
|
||||||
|
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
||||||
|
)
|
||||||
|
#if COMPATIBLE
|
||||||
|
.Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector2(0, endValue.y), duration / (numJumps * 2))
|
||||||
|
#else
|
||||||
|
.Join(DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue.y), duration / (numJumps * 2))
|
||||||
|
#endif
|
||||||
|
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
|
||||||
|
.SetLoops(numJumps * 2, LoopType.Yoyo)
|
||||||
|
)
|
||||||
|
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Blendables
|
#region Blendables
|
||||||
|
|||||||
@ -1054,6 +1054,15 @@
|
|||||||
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
<param name="axisConstraint">Eventual axis constraint for the rotation</param>
|
||||||
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
<param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody 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.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOResize(UnityEngine.TrailRenderer,System.Single,System.Single,System.Single)">
|
||||||
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
<summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
|
||||||
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
|
||||||
@ -1238,6 +1247,15 @@
|
|||||||
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
<param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
|
||||||
Setting it to 0 will shake along a single direction.</param>
|
Setting it to 0 will shake along a single direction.</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Transform,UnityEngine.Vector3,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Transform's X/Z position 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.
@ -43,6 +43,15 @@
|
|||||||
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.ShortcutExtensions.DOJump(UnityEngine.Rigidbody2D,UnityEngine.Vector2,System.Int32,System.Single,System.Boolean)">
|
||||||
|
<summary>Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis.
|
||||||
|
Returns a Sequence instead of a Tweener.
|
||||||
|
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
|
||||||
|
<param name="endValue">The X 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.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
|
||||||
<summary>Tweens a SpriteRenderer's color to the given value,
|
<summary>Tweens a SpriteRenderer's color to the given value,
|
||||||
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
in a way that allows other DOBlendableColor tweens to work together on the same target,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user