mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2026-02-04 14:24:55 +08:00
[MAJOR REFACTORING] Added From overload that allows to set directly the start value of a tween
This commit is contained in:
parent
3b1a1b3599
commit
759292859c
@ -273,6 +273,9 @@
|
|||||||
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.SetFrom(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},System.Boolean)">
|
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.SetFrom(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},System.Boolean)">
|
||||||
<summary>INTERNAL: do not use</summary>
|
<summary>INTERNAL: do not use</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.SetFrom(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},UnityEngine.Quaternion,System.Boolean)">
|
||||||
|
<summary>INTERNAL: do not use</summary>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.ConvertToStartValue(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},UnityEngine.Quaternion)">
|
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.ConvertToStartValue(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},UnityEngine.Quaternion)">
|
||||||
<summary>INTERNAL: do not use</summary>
|
<summary>INTERNAL: do not use</summary>
|
||||||
</member>
|
</member>
|
||||||
@ -2383,6 +2386,24 @@
|
|||||||
then immediately sends the target to the previously set endValue.</summary>
|
then immediately sends the target to the previously set endValue.</summary>
|
||||||
<param name="isRelative">If TRUE the FROM value will be calculated as relative to the current one</param>
|
<param name="isRelative">If TRUE the FROM value will be calculated as relative to the current one</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.TweenSettingsExtensions.From``3(DG.Tweening.Core.TweenerCore{``0,``1,``2},``1,System.Boolean)">
|
||||||
|
<summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
<param name="fromValue">Value to start from</param>
|
||||||
|
<param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.TweenSettingsExtensions.From(DG.Tweening.Core.TweenerCore{UnityEngine.Color,UnityEngine.Color,DG.Tweening.Plugins.Options.ColorOptions},System.Single,System.Boolean)">
|
||||||
|
<summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
<param name="fromAlphaValue">Alpha value to start from (in case of Fade tweens)</param>
|
||||||
|
<param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.TweenSettingsExtensions.From(DG.Tweening.Core.TweenerCore{UnityEngine.Vector3,UnityEngine.Vector3,DG.Tweening.Plugins.Options.VectorOptions},System.Single,System.Boolean)">
|
||||||
|
<summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
<param name="fromValue">Value to start from (in case of Vector tweens that act on a single coordinate or scale tweens)</param>
|
||||||
|
<param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.TweenSettingsExtensions.SetDelay``1(``0,System.Single)">
|
<member name="M:DG.Tweening.TweenSettingsExtensions.SetDelay``1(``0,System.Single)">
|
||||||
<summary>Sets a delayed startup for the tween.
|
<summary>Sets a delayed startup for the tween.
|
||||||
<para>Has no effect on Sequences or if the tween has already started</para></summary>
|
<para>Has no effect on Sequences or if the tween has already started</para></summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#if true // MODULE_MARKER
|
#if true // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
#if UNITY_5 || UNITY_2017_1_OR_NEWER
|
#if UNITY_5 || UNITY_2017_1_OR_NEWER
|
||||||
using UnityEngine.Audio; // Required for AudioMixer
|
using UnityEngine.Audio; // Required for AudioMixer
|
||||||
@ -20,19 +22,23 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens an AudioSource's volume to the given value.
|
/// <summary>Tweens an AudioSource's volume to the given value.
|
||||||
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFade(this AudioSource target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFade(this AudioSource target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
if (endValue < 0) endValue = 0;
|
if (endValue < 0) endValue = 0;
|
||||||
else if (endValue > 1) endValue = 1;
|
else if (endValue > 1) endValue = 1;
|
||||||
return DOTween.To(() => target.volume, x => target.volume = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.volume, x => target.volume = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an AudioSource's pitch to the given value.
|
/// <summary>Tweens an AudioSource's pitch to the given value.
|
||||||
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the AudioSource 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>
|
||||||
public static Tweener DOPitch(this AudioSource target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOPitch(this AudioSource target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -45,14 +51,15 @@ namespace DG.Tweening
|
|||||||
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
|
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
|
||||||
/// <param name="floatName">Name given to the exposed float to set</param>
|
/// <param name="floatName">Name given to the exposed float to set</param>
|
||||||
/// <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>
|
||||||
public static Tweener DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(()=> {
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(()=> {
|
||||||
float currVal;
|
float currVal;
|
||||||
target.GetFloat(floatName, out currVal);
|
target.GetFloat(floatName, out currVal);
|
||||||
return currVal;
|
return currVal;
|
||||||
}, x=> target.SetFloat(floatName, x), endValue, duration)
|
}, x=> target.SetFloat(floatName, x), endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Operation Shortcuts
|
#region Operation Shortcuts
|
||||||
|
|||||||
@ -23,47 +23,51 @@ namespace DG.Tweening
|
|||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, endValue, duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's X position to the given value.
|
/// <summary>Tweens a Rigidbody's X position to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's Y position to the given value.
|
/// <summary>Tweens a Rigidbody's Y position to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's Z position to the given value.
|
/// <summary>Tweens a Rigidbody's Z position to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's rotation to the given value.
|
/// <summary>Tweens a Rigidbody's rotation to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <param name="mode">Rotation mode</param>
|
/// <param name="mode">Rotation mode</param>
|
||||||
public static Tweener DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
@ -76,7 +80,7 @@ namespace DG.Tweening
|
|||||||
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
|
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
|
||||||
/// <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>
|
||||||
public static Tweener DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
||||||
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
|
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER
|
#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
@ -18,39 +20,43 @@ namespace DG.Tweening
|
|||||||
/// 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's X position to the given value.
|
/// <summary>Tweens a Rigidbody2D's X position to the given value.
|
||||||
/// 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's Y position to the given value.
|
/// <summary>Tweens a Rigidbody2D's Y position to the given value.
|
||||||
/// 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's rotation to the given value.
|
/// <summary>Tweens a Rigidbody2D's rotation to the given value.
|
||||||
/// 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>
|
||||||
public static Tweener DORotate(this Rigidbody2D target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DORotate(this Rigidbody2D target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Special
|
#region Special
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
@ -18,18 +19,21 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a SpriteRenderer's color to the given value.
|
/// <summary>Tweens a SpriteRenderer's color to the given value.
|
||||||
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the spriteRenderer 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>
|
||||||
public static Tweener DOColor(this SpriteRenderer target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SpriteRenderer target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's alpha color to the given value.
|
/// <summary>Tweens a Material's alpha color to the given value.
|
||||||
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the spriteRenderer 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>
|
||||||
public static Tweener DOFade(this SpriteRenderer target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SpriteRenderer target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a SpriteRenderer's color using the given gradient
|
/// <summary>Tweens a SpriteRenderer's color using the given gradient
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Core.Enums;
|
using DG.Tweening.Core.Enums;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
@ -20,10 +21,11 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a CanvasGroup's alpha color to the given value.
|
/// <summary>Tweens a CanvasGroup's alpha color to the given value.
|
||||||
/// Also stores the canvasGroup as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the canvasGroup 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>
|
||||||
public static Tweener DOFade(this CanvasGroup target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFade(this CanvasGroup target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -33,18 +35,21 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens an Graphic's color to the given value.
|
/// <summary>Tweens an Graphic's color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOColor(this Graphic target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Graphic target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Graphic's alpha color to the given value.
|
/// <summary>Tweens an Graphic's alpha color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOFade(this Graphic target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Graphic target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -54,29 +59,33 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens an Image's color to the given value.
|
/// <summary>Tweens an Image's color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOColor(this Image target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Image target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Image's alpha color to the given value.
|
/// <summary>Tweens an Image's alpha color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOFade(this Image target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Image target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Image's fillAmount to the given value.
|
/// <summary>Tweens an Image's fillAmount to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFillAmount(this Image target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFillAmount(this Image target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
if (endValue > 1) endValue = 1;
|
if (endValue > 1) endValue = 1;
|
||||||
else if (endValue < 0) endValue = 0;
|
else if (endValue < 0) endValue = 0;
|
||||||
return DOTween.To(() => target.fillAmount, x => target.fillAmount = x, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.fillAmount, x => target.fillAmount = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Image's colors using the given gradient
|
/// <summary>Tweens an Image's colors using the given gradient
|
||||||
@ -110,39 +119,42 @@ namespace DG.Tweening
|
|||||||
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the LayoutElement 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => {
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => {
|
||||||
target.flexibleWidth = x.x;
|
target.flexibleWidth = x.x;
|
||||||
target.flexibleHeight = x.y;
|
target.flexibleHeight = x.y;
|
||||||
}, endValue, duration)
|
}, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an LayoutElement's minWidth/Height to the given value.
|
/// <summary>Tweens an LayoutElement's minWidth/Height to the given value.
|
||||||
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the LayoutElement 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => {
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => {
|
||||||
target.minWidth = x.x;
|
target.minWidth = x.x;
|
||||||
target.minHeight = x.y;
|
target.minHeight = x.y;
|
||||||
}, endValue, duration)
|
}, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an LayoutElement's preferredWidth/Height to the given value.
|
/// <summary>Tweens an LayoutElement's preferredWidth/Height to the given value.
|
||||||
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the LayoutElement 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => {
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => {
|
||||||
target.preferredWidth = x.x;
|
target.preferredWidth = x.x;
|
||||||
target.preferredHeight = x.y;
|
target.preferredHeight = x.y;
|
||||||
}, endValue, duration)
|
}, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -152,27 +164,31 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Outline's effectColor to the given value.
|
/// <summary>Tweens a Outline's effectColor to the given value.
|
||||||
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Outline 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>
|
||||||
public static Tweener DOColor(this Outline target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outline target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.effectColor, x => target.effectColor = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.effectColor, x => target.effectColor = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Outline's effectColor alpha to the given value.
|
/// <summary>Tweens a Outline's effectColor alpha to the given value.
|
||||||
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Outline 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>
|
||||||
public static Tweener DOFade(this Outline target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outline target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Outline's effectDistance to the given value.
|
/// <summary>Tweens a Outline's effectDistance to the given value.
|
||||||
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Outline 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>
|
||||||
public static Tweener DOScale(this Outline target, Vector2 endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOScale(this Outline target, Vector2 endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -183,120 +199,133 @@ namespace DG.Tweening
|
|||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPos(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition X to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition X to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPosX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPosX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue, 0), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition Y to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition Y to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPosY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPosY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, endValue), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3D(this RectTransform target, Vector3 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3D(this RectTransform target, Vector3 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, endValue, duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D X to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D X to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3DX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(endValue, 0, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(endValue, 0, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D Y to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D Y to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3DY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, endValue, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D Z to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D Z to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3DZ(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DZ(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, 0, endValue), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, 0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's anchorMax to the given value.
|
/// <summary>Tweens a RectTransform's anchorMax to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorMax(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorMax(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchorMax, x => target.anchorMax = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchorMax, x => target.anchorMax = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's anchorMin to the given value.
|
/// <summary>Tweens a RectTransform's anchorMin to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorMin(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorMin(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchorMin, x => target.anchorMin = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchorMin, x => target.anchorMin = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's pivot to the given value.
|
/// <summary>Tweens a RectTransform's pivot to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
public static Tweener DOPivot(this RectTransform target, Vector2 endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivot(this RectTransform target, Vector2 endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pivot, x => target.pivot = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's pivot X to the given value.
|
/// <summary>Tweens a RectTransform's pivot X to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
public static Tweener DOPivotX(this RectTransform target, float endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivotX(this RectTransform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(endValue, 0), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X).SetTarget(target);
|
t.SetOptions(AxisConstraint.X).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's pivot Y to the given value.
|
/// <summary>Tweens a RectTransform's pivot Y to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
public static Tweener DOPivotY(this RectTransform target, float endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivotY(this RectTransform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(0, endValue), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Y).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's sizeDelta to the given value.
|
/// <summary>Tweens a RectTransform's sizeDelta to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOSizeDelta(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOSizeDelta(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.sizeDelta, x => target.sizeDelta = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.sizeDelta, x => target.sizeDelta = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Punches a RectTransform's anchoredPosition towards the given direction and then back to the starting one
|
/// <summary>Punches a RectTransform's anchoredPosition towards the given direction and then back to the starting one
|
||||||
@ -430,10 +459,11 @@ namespace DG.Tweening
|
|||||||
/// Also stores the Slider as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Slider 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOValue(this Slider target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<float, float, FloatOptions> DOValue(this Slider target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.value, x => target.value = x, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.value, x => target.value = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -443,18 +473,21 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Text's color to the given value.
|
/// <summary>Tweens a Text's color to the given value.
|
||||||
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Text 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>
|
||||||
public static Tweener DOColor(this Text target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Text target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Text's alpha color to the given value.
|
/// <summary>Tweens a Text's alpha color to the given value.
|
||||||
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Text 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>
|
||||||
public static Tweener DOFade(this Text target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Text target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Text's text to the given value.
|
/// <summary>Tweens a Text's text to the given value.
|
||||||
@ -466,11 +499,12 @@ namespace DG.Tweening
|
|||||||
/// <param name="scrambleChars">A string containing the characters to use for scrambling.
|
/// <param name="scrambleChars">A string containing the characters to use for scrambling.
|
||||||
/// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
|
/// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
|
||||||
/// Leave it to NULL (default) to use default ones</param>
|
/// Leave it to NULL (default) to use default ones</param>
|
||||||
public static Tweener DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
|
public static TweenerCore<string, string, StringOptions> DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.text, x => target.text = x, endValue, duration)
|
TweenerCore<string, string, StringOptions> t = DOTween.To(() => target.text, x => target.text = x, endValue, duration);
|
||||||
.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
|
t.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
@ -178,13 +179,15 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's named texture scale property with the given ID to the given value.
|
/// <summary>Tweens a Material's named texture scale property with the given ID to the given value.
|
||||||
@ -192,13 +195,15 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d3e15b806a8368742ba6f10e794d7b76
|
guid: d3e15b806a8368742ba6f10e794d7b76
|
||||||
timeCreated: 1551364502
|
timeCreated: 1551372288
|
||||||
licenseType: Pro
|
licenseType: Pro
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -25,6 +25,12 @@ public class CustomRangePlugin : ABSTweenPlugin<CustomRange, CustomRange, NoOpti
|
|||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetFrom(TweenerCore<CustomRange, CustomRange, NoOptions> t, CustomRange fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
// Used by special plugins, just let it return the given value
|
// Used by special plugins, just let it return the given value
|
||||||
public override CustomRange ConvertToStartValue(TweenerCore<CustomRange, CustomRange, NoOptions> t, CustomRange value)
|
public override CustomRange ConvertToStartValue(TweenerCore<CustomRange, CustomRange, NoOptions> t, CustomRange value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0e19028f4214f3241b7878d71060677c
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1444384496
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
using DG.Tweening;
|
|
||||||
using DG.Tweening.Core;
|
|
||||||
using DG.Tweening.Core.Easing;
|
|
||||||
using DG.Tweening.Core.Enums;
|
|
||||||
using DG.Tweening.Plugins.Core;
|
|
||||||
using DG.Tweening.Plugins.Options;
|
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public struct PlugCustomPlugin : IPlugSetter<Vector3, Vector3, CustomPlugin, NoOptions>
|
|
||||||
{
|
|
||||||
readonly Vector3 _endValue;
|
|
||||||
readonly DOGetter<Vector3> _getter;
|
|
||||||
readonly DOSetter<Vector3> _setter;
|
|
||||||
|
|
||||||
public PlugCustomPlugin(DOGetter<Vector3> getter, DOSetter<Vector3> setter, float endValue)
|
|
||||||
{
|
|
||||||
_getter = getter;
|
|
||||||
_setter = setter;
|
|
||||||
_endValue = new Vector3(endValue, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DOGetter<Vector3> Getter() { return _getter; }
|
|
||||||
public DOSetter<Vector3> Setter() { return _setter; }
|
|
||||||
public Vector3 EndValue() { return _endValue; }
|
|
||||||
public NoOptions GetOptions() { return new NoOptions(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
// ||| CLASS |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
public class CustomPlugin : ABSTweenPlugin<Vector3,Vector3,NoOptions>
|
|
||||||
{
|
|
||||||
public override void Reset(TweenerCore<Vector3, Vector3, NoOptions> t) {}
|
|
||||||
|
|
||||||
public override void SetFrom(TweenerCore<Vector3, Vector3, NoOptions> t, bool isRelative)
|
|
||||||
{
|
|
||||||
Vector3 prevEndVal = t.endValue;
|
|
||||||
t.endValue = t.getter();
|
|
||||||
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
|
||||||
t.setter(t.startValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector3 ConvertToStartValue(TweenerCore<Vector3, Vector3, NoOptions> t, Vector3 value)
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetRelativeEndValue(TweenerCore<Vector3, Vector3, NoOptions> t)
|
|
||||||
{
|
|
||||||
t.endValue = t.startValue + t.changeValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetChangeValue(TweenerCore<Vector3, Vector3, NoOptions> t)
|
|
||||||
{
|
|
||||||
t.changeValue = t.endValue - t.startValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, Vector3 changeValue)
|
|
||||||
{
|
|
||||||
float res = changeValue.magnitude / unitsXSecond;
|
|
||||||
if (res < 0) res = -res;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
|
||||||
{
|
|
||||||
Vector3 res = getter();
|
|
||||||
float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
|
|
||||||
res.x = startValue.x + changeValue.x * easeVal;
|
|
||||||
setter(res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -14,7 +14,7 @@ public class DOCompletePerformance : BrainBase
|
|||||||
Debug.Log(Time.realtimeSinceStartup + " :: Create " + totTweens + " tweens on " + (tweenFloatValue ? "float" : "transform"));
|
Debug.Log(Time.realtimeSinceStartup + " :: Create " + totTweens + " tweens on " + (tweenFloatValue ? "float" : "transform"));
|
||||||
for (int i = 0; i < totTweens; ++i) {
|
for (int i = 0; i < totTweens; ++i) {
|
||||||
Tween t = tweenFloatValue
|
Tween t = tweenFloatValue
|
||||||
? DOTween.To(()=> floatValue, x=> floatValue = x, 2, 10)
|
? (Tween)DOTween.To(()=> floatValue, x=> floatValue = x, 2, 10)
|
||||||
: target.DOMoveX(2, 10);
|
: target.DOMoveX(2, 10);
|
||||||
if (!byTarget) t.SetId("myId");
|
if (!byTarget) t.SetId("myId");
|
||||||
else if (tweenFloatValue) t.SetTarget(target);
|
else if (tweenFloatValue) t.SetTarget(target);
|
||||||
|
|||||||
19
UnityTests.Unity5/Assets/_Tests/FromValue.cs
Normal file
19
UnityTests.Unity5/Assets/_Tests/FromValue.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using DG.Tweening;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class FromValue : BrainBase
|
||||||
|
{
|
||||||
|
public GameObject cube;
|
||||||
|
|
||||||
|
IEnumerator Start()
|
||||||
|
{
|
||||||
|
Tween t = cube.transform.DOMoveX(2, 2);
|
||||||
|
yield return t.WaitForCompletion();
|
||||||
|
|
||||||
|
t = cube.transform.DOMoveX(3, 2).From(10);
|
||||||
|
cube.GetComponent<Renderer>().material.DOFade(1, 2).From(0.5f);
|
||||||
|
yield return t.WaitForCompletion();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,12 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: af2497efc5625554ba3ad4d45cdad868
|
guid: 7f8e935c8c281c14fa14d16a06261fd3
|
||||||
|
timeCreated: 1551447234
|
||||||
|
licenseType: Pro
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
UnityTests.Unity5/Assets/_Tests/FromValue.unity
Normal file
BIN
UnityTests.Unity5/Assets/_Tests/FromValue.unity
Normal file
Binary file not shown.
4
UnityTests.Unity5/Assets/_Tests/FromValue.unity.meta
Normal file
4
UnityTests.Unity5/Assets/_Tests/FromValue.unity.meta
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a0295fa208ad901478c17ea6714f74d6
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
@ -124,6 +124,17 @@ namespace DG.Tweening.Core
|
|||||||
hasManuallySetStartValue = true;
|
hasManuallySetStartValue = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
// Sets From tweens in an alternate way where you can set the start value directly
|
||||||
|
// (instead of setting it from the endValue).
|
||||||
|
// Plugins that don't support From:
|
||||||
|
// - Vector3ArrayPlugin
|
||||||
|
// - Pro > PathPlugin, SpiralPlugin
|
||||||
|
internal Tweener SetFrom(T2 fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
tweenPlugin.SetFrom(this, fromValue, setImmediately);
|
||||||
|
hasManuallySetStartValue = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// _tweenPlugin is not reset since it's useful to keep it as a reference
|
// _tweenPlugin is not reset since it's useful to keep it as a reference
|
||||||
internal sealed override void Reset()
|
internal sealed override void Reset()
|
||||||
|
|||||||
@ -44,6 +44,12 @@ namespace DG.Tweening.CustomPlugins
|
|||||||
t.startValue = isRelative ? t.endValue * prevEndVal : prevEndVal;
|
t.startValue = isRelative ? t.endValue * prevEndVal : prevEndVal;
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
/// <summary>INTERNAL: do not use</summary>
|
||||||
|
public override void SetFrom(TweenerCore<Quaternion, Quaternion, NoOptions> t, Quaternion fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>INTERNAL: do not use</summary>
|
/// <summary>INTERNAL: do not use</summary>
|
||||||
public override Quaternion ConvertToStartValue(TweenerCore<Quaternion, Quaternion, NoOptions> t, Quaternion value)
|
public override Quaternion ConvertToStartValue(TweenerCore<Quaternion, Quaternion, NoOptions> t, Quaternion value)
|
||||||
|
|||||||
@ -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.2.211"; // Last version before modules: 1.1.755
|
public static readonly string Version = "1.2.220"; // Last version before modules: 1.1.755
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
@ -312,7 +312,7 @@ namespace DG.Tweening
|
|||||||
/// <param name="setter">A setter for the field or property to tween
|
/// <param name="setter">A setter for the field or property to tween
|
||||||
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
||||||
public static Tweener To(DOGetter<int> getter, DOSetter<int> setter, int endValue,float duration)
|
public static TweenerCore<int, int, NoOptions> To(DOGetter<int> getter, DOSetter<int> setter, int endValue,float duration)
|
||||||
{ return ApplyTo<int, int, NoOptions>(getter, setter, endValue, duration); }
|
{ return ApplyTo<int, int, NoOptions>(getter, setter, endValue, duration); }
|
||||||
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
||||||
/// <param name="getter">A getter for the field or property to tween.
|
/// <param name="getter">A getter for the field or property to tween.
|
||||||
@ -320,7 +320,7 @@ namespace DG.Tweening
|
|||||||
/// <param name="setter">A setter for the field or property to tween
|
/// <param name="setter">A setter for the field or property to tween
|
||||||
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
||||||
public static Tweener To(DOGetter<uint> getter, DOSetter<uint> setter, uint endValue, float duration)
|
public static TweenerCore<uint, uint, UintOptions> To(DOGetter<uint> getter, DOSetter<uint> setter, uint endValue, float duration)
|
||||||
{ return ApplyTo<uint, uint, UintOptions>(getter, setter, endValue, duration); }
|
{ return ApplyTo<uint, uint, UintOptions>(getter, setter, endValue, duration); }
|
||||||
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
||||||
/// <param name="getter">A getter for the field or property to tween.
|
/// <param name="getter">A getter for the field or property to tween.
|
||||||
@ -328,7 +328,7 @@ namespace DG.Tweening
|
|||||||
/// <param name="setter">A setter for the field or property to tween
|
/// <param name="setter">A setter for the field or property to tween
|
||||||
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
||||||
public static Tweener To(DOGetter<long> getter, DOSetter<long> setter, long endValue, float duration)
|
public static TweenerCore<long, long, NoOptions> To(DOGetter<long> getter, DOSetter<long> setter, long endValue, float duration)
|
||||||
{ return ApplyTo<long, long, NoOptions>(getter, setter, endValue, duration); }
|
{ return ApplyTo<long, long, NoOptions>(getter, setter, endValue, duration); }
|
||||||
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
||||||
/// <param name="getter">A getter for the field or property to tween.
|
/// <param name="getter">A getter for the field or property to tween.
|
||||||
@ -336,7 +336,7 @@ namespace DG.Tweening
|
|||||||
/// <param name="setter">A setter for the field or property to tween
|
/// <param name="setter">A setter for the field or property to tween
|
||||||
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
||||||
public static Tweener To(DOGetter<ulong> getter, DOSetter<ulong> setter, ulong endValue, float duration)
|
public static TweenerCore<ulong, ulong, NoOptions> To(DOGetter<ulong> getter, DOSetter<ulong> setter, ulong endValue, float duration)
|
||||||
{ return ApplyTo<ulong, ulong, NoOptions>(getter, setter, endValue, duration); }
|
{ return ApplyTo<ulong, ulong, NoOptions>(getter, setter, endValue, duration); }
|
||||||
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
/// <summary>Tweens a property or field to the given value using default plugins</summary>
|
||||||
/// <param name="getter">A getter for the field or property to tween.
|
/// <param name="getter">A getter for the field or property to tween.
|
||||||
@ -431,14 +431,19 @@ namespace DG.Tweening
|
|||||||
t.plugOptions.axisConstraint = axisConstraint;
|
t.plugOptions.axisConstraint = axisConstraint;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens only the alpha of a Color to the given value using default plugins</summary>
|
/// <summary>Tweens only the alpha of a Color to the given value using default plugins</summary>
|
||||||
/// <param name="getter">A getter for the field or property to tween.
|
/// <param name="getter">A getter for the field or property to tween.
|
||||||
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
|
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
|
||||||
/// <param name="setter">A setter for the field or property to tween
|
/// <param name="setter">A setter for the field or property to tween
|
||||||
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
/// <para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
|
||||||
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
/// <param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
|
||||||
public static Tweener ToAlpha(DOGetter<DOColor> getter, DOSetter<DOColor> setter, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> ToAlpha(DOGetter<DOColor> getter, DOSetter<DOColor> setter, float endValue, float duration)
|
||||||
{ return ApplyTo<DOColor, DOColor, ColorOptions>(getter, setter, new Color(0, 0, 0, endValue), duration).SetOptions(true); }
|
{
|
||||||
|
TweenerCore<Color, Color, ColorOptions> t = ApplyTo<DOColor, DOColor, ColorOptions>(getter, setter, new Color(0, 0, 0, endValue), duration);
|
||||||
|
t.SetOptions(true);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,19 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
t.setter(to);
|
t.setter(to);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<Color2, Color2, ColorOptions> t, Color2 fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) {
|
||||||
|
Color2 to = fromValue;
|
||||||
|
if (t.plugOptions.alphaOnly) {
|
||||||
|
to = t.getter();
|
||||||
|
to.ca.a = fromValue.ca.a;
|
||||||
|
to.cb.a = fromValue.cb.a;
|
||||||
|
}
|
||||||
|
t.setter(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Color2 ConvertToStartValue(TweenerCore<Color2, Color2, ColorOptions> t, Color2 value)
|
public override Color2 ConvertToStartValue(TweenerCore<Color2, Color2, ColorOptions> t, Color2 value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,6 +29,18 @@ namespace DG.Tweening.Plugins
|
|||||||
else to.a = t.startValue.a;
|
else to.a = t.startValue.a;
|
||||||
t.setter(to);
|
t.setter(to);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<Color, Color, ColorOptions> t, Color fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) {
|
||||||
|
Color to = fromValue;
|
||||||
|
if (t.plugOptions.alphaOnly) {
|
||||||
|
to = t.getter();
|
||||||
|
to.a = fromValue.a;
|
||||||
|
}
|
||||||
|
t.setter(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Color ConvertToStartValue(TweenerCore<Color, Color, ColorOptions> t, Color value)
|
public override Color ConvertToStartValue(TweenerCore<Color, Color, ColorOptions> t, Color value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,6 +16,7 @@ namespace DG.Tweening.Plugins.Core
|
|||||||
{
|
{
|
||||||
public abstract void Reset(TweenerCore<T1, T2, TPlugOptions> t); // Resets specific TweenerCore stuff, not the plugin itself
|
public abstract void Reset(TweenerCore<T1, T2, TPlugOptions> t); // Resets specific TweenerCore stuff, not the plugin itself
|
||||||
public abstract void SetFrom(TweenerCore<T1, T2, TPlugOptions> t, bool isRelative);
|
public abstract void SetFrom(TweenerCore<T1, T2, TPlugOptions> t, bool isRelative);
|
||||||
|
public abstract void SetFrom(TweenerCore<T1, T2, TPlugOptions> t, T2 fromValue, bool setImmediately);
|
||||||
public abstract T2 ConvertToStartValue(TweenerCore<T1, T2, TPlugOptions> t, T1 value);
|
public abstract T2 ConvertToStartValue(TweenerCore<T1, T2, TPlugOptions> t, T1 value);
|
||||||
public abstract void SetRelativeEndValue(TweenerCore<T1, T2, TPlugOptions> t);
|
public abstract void SetRelativeEndValue(TweenerCore<T1, T2, TPlugOptions> t);
|
||||||
public abstract void SetChangeValue(TweenerCore<T1, T2, TPlugOptions> t);
|
public abstract void SetChangeValue(TweenerCore<T1, T2, TPlugOptions> t);
|
||||||
|
|||||||
@ -24,6 +24,11 @@ namespace DG.Tweening.Plugins
|
|||||||
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<double, double, NoOptions> t, double fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
public override double ConvertToStartValue(TweenerCore<double, double, NoOptions> t, double value)
|
public override double ConvertToStartValue(TweenerCore<double, double, NoOptions> t, double value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -26,6 +26,11 @@ namespace DG.Tweening.Plugins
|
|||||||
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
||||||
t.setter(!t.plugOptions.snapping ? t.startValue : (float)Math.Round(t.startValue));
|
t.setter(!t.plugOptions.snapping ? t.startValue : (float)Math.Round(t.startValue));
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<float, float, FloatOptions> t, float fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(!t.plugOptions.snapping ? fromValue : (float)Math.Round(fromValue));
|
||||||
|
}
|
||||||
|
|
||||||
public override float ConvertToStartValue(TweenerCore<float, float, FloatOptions> t, float value)
|
public override float ConvertToStartValue(TweenerCore<float, float, FloatOptions> t, float value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,6 +25,11 @@ namespace DG.Tweening.Plugins
|
|||||||
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<int, int, NoOptions> t, int fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
public override int ConvertToStartValue(TweenerCore<int, int, NoOptions> t, int value)
|
public override int ConvertToStartValue(TweenerCore<int, int, NoOptions> t, int value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,6 +22,11 @@ namespace DG.Tweening.Plugins
|
|||||||
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<long, long, NoOptions> t, long fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
public override long ConvertToStartValue(TweenerCore<long, long, NoOptions> t, long value)
|
public override long ConvertToStartValue(TweenerCore<long, long, NoOptions> t, long value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,6 +29,7 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void SetFrom(TweenerCore<Vector3, Path, PathOptions> t, bool isRelative) {}
|
public override void SetFrom(TweenerCore<Vector3, Path, PathOptions> t, bool isRelative) {}
|
||||||
|
public override void SetFrom(TweenerCore<Vector3, Path, PathOptions> t, Path fromValue, bool setImmediately) {}
|
||||||
|
|
||||||
public static ABSTweenPlugin<Vector3, Path, PathOptions> Get()
|
public static ABSTweenPlugin<Vector3, Path, PathOptions> Get()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,6 +38,11 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
t.setter(Quaternion.Euler(t.startValue));
|
t.setter(Quaternion.Euler(t.startValue));
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<Quaternion, Vector3, QuaternionOptions> t, Vector3 fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(Quaternion.Euler(fromValue));
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector3 ConvertToStartValue(TweenerCore<Quaternion, Vector3, QuaternionOptions> t, Quaternion value)
|
public override Vector3 ConvertToStartValue(TweenerCore<Quaternion, Vector3, QuaternionOptions> t, Quaternion value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,6 +39,11 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<RectOffset, RectOffset, NoOptions> t, RectOffset fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
public override RectOffset ConvertToStartValue(TweenerCore<RectOffset, RectOffset, NoOptions> t, RectOffset value)
|
public override RectOffset ConvertToStartValue(TweenerCore<RectOffset, RectOffset, NoOptions> t, RectOffset value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,6 +39,20 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
t.setter(to);
|
t.setter(to);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<Rect, Rect, RectOptions> t, Rect fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) {
|
||||||
|
Rect to = fromValue;
|
||||||
|
if (t.plugOptions.snapping) {
|
||||||
|
to.x = (float)Math.Round(to.x);
|
||||||
|
to.y = (float)Math.Round(to.y);
|
||||||
|
to.width = (float)Math.Round(to.width);
|
||||||
|
to.height = (float)Math.Round(to.height);
|
||||||
|
}
|
||||||
|
t.setter(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Rect ConvertToStartValue(TweenerCore<Rect, Rect, RectOptions> t, Rect value)
|
public override Rect ConvertToStartValue(TweenerCore<Rect, Rect, RectOptions> t, Rect value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,6 +32,11 @@ namespace DG.Tweening.Plugins
|
|||||||
t.startValue = prevEndVal;
|
t.startValue = prevEndVal;
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<string, string, StringOptions> t, string fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Reset(TweenerCore<string, string, StringOptions> t)
|
public override void Reset(TweenerCore<string, string, StringOptions> t)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -26,6 +26,11 @@ namespace DG.Tweening.Plugins
|
|||||||
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<uint, uint, UintOptions> t, uint fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
public override uint ConvertToStartValue(TweenerCore<uint, uint, UintOptions> t, uint value)
|
public override uint ConvertToStartValue(TweenerCore<uint, uint, UintOptions> t, uint value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,6 +23,11 @@ namespace DG.Tweening.Plugins
|
|||||||
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
|
||||||
t.setter(t.startValue);
|
t.setter(t.startValue);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<ulong, ulong, NoOptions> t, ulong fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) t.setter(fromValue);
|
||||||
|
}
|
||||||
|
|
||||||
public override ulong ConvertToStartValue(TweenerCore<ulong, ulong, NoOptions> t, ulong value)
|
public override ulong ConvertToStartValue(TweenerCore<ulong, ulong, NoOptions> t, ulong value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,6 +43,31 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
t.setter(to);
|
t.setter(to);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<Vector2, Vector2, VectorOptions> t, Vector2 fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) {
|
||||||
|
Vector2 to;
|
||||||
|
switch (t.plugOptions.axisConstraint) {
|
||||||
|
case AxisConstraint.X:
|
||||||
|
to = t.getter();
|
||||||
|
to.x = fromValue.x;
|
||||||
|
break;
|
||||||
|
case AxisConstraint.Y:
|
||||||
|
to = t.getter();
|
||||||
|
to.y = fromValue.y;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
to = fromValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (t.plugOptions.snapping) {
|
||||||
|
to.x = (float)Math.Round(to.x);
|
||||||
|
to.y = (float)Math.Round(to.y);
|
||||||
|
}
|
||||||
|
t.setter(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector2 ConvertToStartValue(TweenerCore<Vector2, Vector2, VectorOptions> t, Vector2 value)
|
public override Vector2 ConvertToStartValue(TweenerCore<Vector2, Vector2, VectorOptions> t, Vector2 value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -26,6 +26,7 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void SetFrom(TweenerCore<Vector3, Vector3[], Vector3ArrayOptions> t, bool isRelative) {}
|
public override void SetFrom(TweenerCore<Vector3, Vector3[], Vector3ArrayOptions> t, bool isRelative) {}
|
||||||
|
public override void SetFrom(TweenerCore<Vector3, Vector3[], Vector3ArrayOptions> t, Vector3[] fromValue, bool setImmediately) {}
|
||||||
|
|
||||||
public override Vector3[] ConvertToStartValue(TweenerCore<Vector3, Vector3[], Vector3ArrayOptions> t, Vector3 value)
|
public override Vector3[] ConvertToStartValue(TweenerCore<Vector3, Vector3[], Vector3ArrayOptions> t, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,6 +47,36 @@ namespace DG.Tweening.Plugins
|
|||||||
}
|
}
|
||||||
t.setter(to);
|
t.setter(to);
|
||||||
}
|
}
|
||||||
|
public override void SetFrom(TweenerCore<Vector3, Vector3, VectorOptions> t, Vector3 fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) {
|
||||||
|
Vector3 to;
|
||||||
|
switch (t.plugOptions.axisConstraint) {
|
||||||
|
case AxisConstraint.X:
|
||||||
|
to = t.getter();
|
||||||
|
to.x = fromValue.x;
|
||||||
|
break;
|
||||||
|
case AxisConstraint.Y:
|
||||||
|
to = t.getter();
|
||||||
|
to.y = fromValue.y;
|
||||||
|
break;
|
||||||
|
case AxisConstraint.Z:
|
||||||
|
to = t.getter();
|
||||||
|
to.z = fromValue.z;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
to = fromValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (t.plugOptions.snapping) {
|
||||||
|
to.x = (float)Math.Round(to.x);
|
||||||
|
to.y = (float)Math.Round(to.y);
|
||||||
|
to.z = (float)Math.Round(to.z);
|
||||||
|
}
|
||||||
|
t.setter(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector3 ConvertToStartValue(TweenerCore<Vector3, Vector3, VectorOptions> t, Vector3 value)
|
public override Vector3 ConvertToStartValue(TweenerCore<Vector3, Vector3, VectorOptions> t, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,6 +52,42 @@ namespace DG.Tweening.Plugins
|
|||||||
t.setter(to);
|
t.setter(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetFrom(TweenerCore<Vector4, Vector4, VectorOptions> t, Vector4 fromValue, bool setImmediately)
|
||||||
|
{
|
||||||
|
t.startValue = fromValue;
|
||||||
|
if (setImmediately) {
|
||||||
|
Vector4 to;
|
||||||
|
switch (t.plugOptions.axisConstraint) {
|
||||||
|
case AxisConstraint.X:
|
||||||
|
to = t.getter();
|
||||||
|
to.x = fromValue.x;
|
||||||
|
break;
|
||||||
|
case AxisConstraint.Y:
|
||||||
|
to = t.getter();
|
||||||
|
to.y = fromValue.y;
|
||||||
|
break;
|
||||||
|
case AxisConstraint.Z:
|
||||||
|
to = t.getter();
|
||||||
|
to.z = fromValue.z;
|
||||||
|
break;
|
||||||
|
case AxisConstraint.W:
|
||||||
|
to = t.getter();
|
||||||
|
to.w = fromValue.w;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
to = fromValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (t.plugOptions.snapping) {
|
||||||
|
to.x = (float)Math.Round(to.x);
|
||||||
|
to.y = (float)Math.Round(to.y);
|
||||||
|
to.z = (float)Math.Round(to.z);
|
||||||
|
to.w = (float)Math.Round(to.w);
|
||||||
|
}
|
||||||
|
t.setter(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector4 ConvertToStartValue(TweenerCore<Vector4, Vector4, VectorOptions> t, Vector4 value)
|
public override Vector4 ConvertToStartValue(TweenerCore<Vector4, Vector4, VectorOptions> t, Vector4 value)
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@ -36,65 +36,81 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Camera's <code>aspect</code> to the given value.
|
/// <summary>Tweens a Camera's <code>aspect</code> to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DOAspect(this Camera target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOAspect(this Camera target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.aspect, x => target.aspect = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.aspect, x => target.aspect = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Camera's backgroundColor to the given value.
|
/// <summary>Tweens a Camera's backgroundColor to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DOColor(this Camera target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Camera target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.backgroundColor, x => target.backgroundColor = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.backgroundColor, x => target.backgroundColor = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Camera's <code>farClipPlane</code> to the given value.
|
/// <summary>Tweens a Camera's <code>farClipPlane</code> to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DOFarClipPlane(this Camera target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFarClipPlane(this Camera target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.farClipPlane, x => target.farClipPlane = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.farClipPlane, x => target.farClipPlane = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Camera's <code>fieldOfView</code> to the given value.
|
/// <summary>Tweens a Camera's <code>fieldOfView</code> to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DOFieldOfView(this Camera target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFieldOfView(this Camera target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.fieldOfView, x => target.fieldOfView = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.fieldOfView, x => target.fieldOfView = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Camera's <code>nearClipPlane</code> to the given value.
|
/// <summary>Tweens a Camera's <code>nearClipPlane</code> to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DONearClipPlane(this Camera target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DONearClipPlane(this Camera target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.nearClipPlane, x => target.nearClipPlane = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.nearClipPlane, x => target.nearClipPlane = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Camera's <code>orthographicSize</code> to the given value.
|
/// <summary>Tweens a Camera's <code>orthographicSize</code> to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DOOrthoSize(this Camera target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOOrthoSize(this Camera target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.orthographicSize, x => target.orthographicSize = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.orthographicSize, x => target.orthographicSize = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Camera's <code>pixelRect</code> to the given value.
|
/// <summary>Tweens a Camera's <code>pixelRect</code> to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DOPixelRect(this Camera target, Rect endValue, float duration)
|
public static TweenerCore<Rect, Rect, RectOptions> DOPixelRect(this Camera target, Rect endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pixelRect, x => target.pixelRect = x, endValue, duration).SetTarget(target);
|
TweenerCore<Rect, Rect, RectOptions> t = DOTween.To(() => target.pixelRect, x => target.pixelRect = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Camera's <code>rect</code> to the given value.
|
/// <summary>Tweens a Camera's <code>rect</code> to the given value.
|
||||||
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the camera 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>
|
||||||
public static Tweener DORect(this Camera target, Rect endValue, float duration)
|
public static TweenerCore<Rect, Rect, RectOptions> DORect(this Camera target, Rect endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.rect, x => target.rect = x, endValue, duration).SetTarget(target);
|
TweenerCore<Rect, Rect, RectOptions> t = DOTween.To(() => target.rect, x => target.rect = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Shakes a Camera's localPosition along its relative X Y axes with the given values.
|
/// <summary>Shakes a Camera's localPosition along its relative X Y axes with the given values.
|
||||||
@ -174,25 +190,31 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Light's color to the given value.
|
/// <summary>Tweens a Light's color to the given value.
|
||||||
/// Also stores the light as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the light 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>
|
||||||
public static Tweener DOColor(this Light target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Light target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Light's intensity to the given value.
|
/// <summary>Tweens a Light's intensity to the given value.
|
||||||
/// Also stores the light as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the light 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>
|
||||||
public static Tweener DOIntensity(this Light target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOIntensity(this Light target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.intensity, x => target.intensity = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.intensity, x => target.intensity = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Light's shadowStrength to the given value.
|
/// <summary>Tweens a Light's shadowStrength to the given value.
|
||||||
/// Also stores the light as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the light 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>
|
||||||
public static Tweener DOShadowStrength(this Light target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOShadowStrength(this Light target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.shadowStrength, x => target.shadowStrength = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.shadowStrength, x => target.shadowStrength = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -217,45 +239,52 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Material's color to the given value.
|
/// <summary>Tweens a Material's color to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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>
|
||||||
public static Tweener DOColor(this Material target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Material target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's named color property to the given value.
|
/// <summary>Tweens a Material's named color property to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
|
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOColor(this Material target, Color endValue, string property, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Material target, Color endValue, string property, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(property)) {
|
if (!target.HasProperty(property)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetColor(property), x => target.SetColor(property, x), endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.GetColor(property), x => target.SetColor(property, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's named color property with the given ID to the given value.
|
/// <summary>Tweens a Material's named color property with the given ID to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOColor(this Material target, Color endValue, int propertyID, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Material target, Color endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetColor(propertyID), x => target.SetColor(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.GetColor(propertyID), x => target.SetColor(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's alpha color to the given value
|
/// <summary>Tweens a Material's alpha color to the given value
|
||||||
/// (will have no effect unless your material supports transparency).
|
/// (will have no effect unless your material supports transparency).
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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>
|
||||||
public static Tweener DOFade(this Material target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Material target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's alpha color to the given value
|
/// <summary>Tweens a Material's alpha color to the given value
|
||||||
/// (will have no effect unless your material supports transparency).
|
/// (will have no effect unless your material supports transparency).
|
||||||
@ -263,13 +292,15 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
|
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFade(this Material target, float endValue, string property, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Material target, float endValue, string property, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(property)) {
|
if (!target.HasProperty(property)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.ToAlpha(() => target.GetColor(property), x => target.SetColor(property, x), endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.GetColor(property), x => target.SetColor(property, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's alpha color with the given ID to the given value
|
/// <summary>Tweens a Material's alpha color with the given ID to the given value
|
||||||
/// (will have no effect unless your material supports transparency).
|
/// (will have no effect unless your material supports transparency).
|
||||||
@ -277,13 +308,15 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFade(this Material target, float endValue, int propertyID, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Material target, float endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.ToAlpha(() => target.GetColor(propertyID), x => target.SetColor(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.GetColor(propertyID), x => target.SetColor(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's named float property to the given value.
|
/// <summary>Tweens a Material's named float property to the given value.
|
||||||
@ -291,70 +324,82 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="property">The name of the material property to tween</param>
|
/// <param name="property">The name of the material property to tween</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFloat(this Material target, float endValue, string property, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFloat(this Material target, float endValue, string property, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(property)) {
|
if (!target.HasProperty(property)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetFloat(property), x => target.SetFloat(property, x), endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.GetFloat(property), x => target.SetFloat(property, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's named float property with the given ID to the given value.
|
/// <summary>Tweens a Material's named float property with the given ID to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFloat(this Material target, float endValue, int propertyID, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFloat(this Material target, float endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetFloat(propertyID), x => target.SetFloat(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.GetFloat(propertyID), x => target.SetFloat(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's texture offset to the given value.
|
/// <summary>Tweens a Material's texture offset to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOOffset(this Material target, Vector2 endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.mainTextureOffset, x => target.mainTextureOffset = x, endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.mainTextureOffset, x => target.mainTextureOffset = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's named texture offset property to the given value.
|
/// <summary>Tweens a Material's named texture offset property to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="property">The name of the material property to tween</param>
|
/// <param name="property">The name of the material property to tween</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOOffset(this Material target, Vector2 endValue, string property, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, string property, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(property)) {
|
if (!target.HasProperty(property)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetTextureOffset(property), x => target.SetTextureOffset(property, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureOffset(property), x => target.SetTextureOffset(property, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's texture scale to the given value.
|
/// <summary>Tweens a Material's texture scale to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOTiling(this Material target, Vector2 endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.mainTextureScale, x => target.mainTextureScale = x, endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.mainTextureScale, x => target.mainTextureScale = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's named texture scale property to the given value.
|
/// <summary>Tweens a Material's named texture scale property to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="property">The name of the material property to tween</param>
|
/// <param name="property">The name of the material property to tween</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOTiling(this Material target, Vector2 endValue, string property, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, string property, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(property)) {
|
if (!target.HasProperty(property)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetTextureScale(property), x => target.SetTextureScale(property, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureScale(property), x => target.SetTextureScale(property, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's named Vector property to the given value.
|
/// <summary>Tweens a Material's named Vector property to the given value.
|
||||||
@ -362,26 +407,30 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="property">The name of the material property to tween</param>
|
/// <param name="property">The name of the material property to tween</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOVector(this Material target, Vector4 endValue, string property, float duration)
|
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this Material target, Vector4 endValue, string property, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(property)) {
|
if (!target.HasProperty(property)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetVector(property), x => target.SetVector(property, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector4, Vector4, VectorOptions> t = DOTween.To(() => target.GetVector(property), x => target.SetVector(property, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a Material's named Vector property with the given ID to the given value.
|
/// <summary>Tweens a Material's named Vector property with the given ID to the given value.
|
||||||
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the material 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="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOVector(this Material target, Vector4 endValue, int propertyID, float duration)
|
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this Material target, Vector4 endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetVector(propertyID), x => target.SetVector(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector4, Vector4, VectorOptions> t = DOTween.To(() => target.GetVector(propertyID), x => target.SetVector(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -409,10 +458,11 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a TrailRenderer's time to the given value.
|
/// <summary>Tweens a TrailRenderer's time 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOTime(this TrailRenderer target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOTime(this TrailRenderer target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.time, x => target.time = x, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.time, x => target.time = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -423,87 +473,95 @@ namespace DG.Tweening
|
|||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMove(this Transform target, Vector3 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Transform target, Vector3 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, x => target.position = x, endValue, duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, x => target.position = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's X position to the given value.
|
/// <summary>Tweens a Transform's X position to the given value.
|
||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveX(this Transform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<DOVector3,DOVector3,VectorOptions> DOMoveX(this Transform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue, 0, 0), duration)
|
TweenerCore<DOVector3,DOVector3,VectorOptions> t = DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue, 0, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's Y position to the given value.
|
/// <summary>Tweens a Transform's Y position to the given value.
|
||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveY(this Transform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Transform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, x => target.position = x, new Vector3(0, endValue, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, x => target.position = x, new Vector3(0, endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's Z position to the given value.
|
/// <summary>Tweens a Transform's Z position to the given value.
|
||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveZ(this Transform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Transform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's localPosition to the given value.
|
/// <summary>Tweens a Transform's localPosition to the given value.
|
||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOLocalMove(this Transform target, Vector3 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOLocalMove(this Transform target, Vector3 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localPosition, x => target.localPosition = x, endValue, duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localPosition, x => target.localPosition = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's X localPosition to the given value.
|
/// <summary>Tweens a Transform's X localPosition to the given value.
|
||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOLocalMoveX(this Transform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOLocalMoveX(this Transform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue, 0, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue, 0, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's Y localPosition to the given value.
|
/// <summary>Tweens a Transform's Y localPosition to the given value.
|
||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOLocalMoveY(this Transform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOLocalMoveY(this Transform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, endValue, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's Z localPosition to the given value.
|
/// <summary>Tweens a Transform's Z localPosition to the given value.
|
||||||
/// 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="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>
|
||||||
/// <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>
|
||||||
public static Tweener DOLocalMoveZ(this Transform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOLocalMoveZ(this Transform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's rotation to the given value.
|
/// <summary>Tweens a Transform's rotation to the given value.
|
||||||
/// 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="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>
|
||||||
/// <param name="mode">Rotation mode</param>
|
/// <param name="mode">Rotation mode</param>
|
||||||
public static Tweener DORotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
public static TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> DORotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
||||||
{
|
{
|
||||||
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, endValue, duration);
|
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
@ -518,7 +576,7 @@ namespace DG.Tweening
|
|||||||
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
|
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
|
||||||
/// </summary>
|
/// </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>
|
||||||
public static Tweener DORotateQuaternion(this Transform target, Quaternion endValue, float duration)
|
public static TweenerCore<Quaternion, Quaternion, NoOptions> DORotateQuaternion(this Transform target, Quaternion endValue, float duration)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Quaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.rotation, x => target.rotation = x, endValue, duration);
|
TweenerCore<Quaternion, Quaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.rotation, x => target.rotation = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
@ -529,7 +587,7 @@ namespace DG.Tweening
|
|||||||
/// 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="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>
|
||||||
/// <param name="mode">Rotation mode</param>
|
/// <param name="mode">Rotation mode</param>
|
||||||
public static Tweener DOLocalRotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
public static TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> DOLocalRotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
||||||
{
|
{
|
||||||
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.localRotation, x => target.localRotation = x, endValue, duration);
|
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.localRotation, x => target.localRotation = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
@ -544,7 +602,7 @@ namespace DG.Tweening
|
|||||||
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
|
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
|
||||||
/// </summary>
|
/// </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>
|
||||||
public static Tweener DOLocalRotateQuaternion(this Transform target, Quaternion endValue, float duration)
|
public static TweenerCore<Quaternion, Quaternion, NoOptions> DOLocalRotateQuaternion(this Transform target, Quaternion endValue, float duration)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Quaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.localRotation, x => target.localRotation = x, endValue, duration);
|
TweenerCore<Quaternion, Quaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.localRotation, x => target.localRotation = x, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
@ -554,48 +612,55 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Transform's localScale to the given value.
|
/// <summary>Tweens a Transform's localScale to the given value.
|
||||||
/// 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="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>
|
||||||
public static Tweener DOScale(this Transform target, Vector3 endValue, float duration)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOScale(this Transform target, Vector3 endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localScale, x => target.localScale = x, endValue, duration).SetTarget(target);
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localScale, x => target.localScale = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's localScale uniformly to the given value.
|
/// <summary>Tweens a Transform's localScale uniformly to the given value.
|
||||||
/// 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="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>
|
||||||
public static Tweener DOScale(this Transform target, float endValue, float duration)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOScale(this Transform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
Vector3 endValueV3 = new Vector3(endValue, endValue, endValue);
|
Vector3 endValueV3 = new Vector3(endValue, endValue, endValue);
|
||||||
return DOTween.To(() => target.localScale, x => target.localScale = x, endValueV3, duration).SetTarget(target);
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localScale, x => target.localScale = x, endValueV3, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's X localScale to the given value.
|
/// <summary>Tweens a Transform's X localScale to the given value.
|
||||||
/// 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="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>
|
||||||
public static Tweener DOScaleX(this Transform target, float endValue, float duration)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOScaleX(this Transform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(endValue, 0, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(endValue, 0, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X)
|
t.SetOptions(AxisConstraint.X)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's Y localScale to the given value.
|
/// <summary>Tweens a Transform's Y localScale to the given value.
|
||||||
/// 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="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>
|
||||||
public static Tweener DOScaleY(this Transform target, float endValue, float duration)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOScaleY(this Transform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, endValue, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.Y)
|
t.SetOptions(AxisConstraint.Y)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's Z localScale to the given value.
|
/// <summary>Tweens a Transform's Z localScale to the given value.
|
||||||
/// 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="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>
|
||||||
public static Tweener DOScaleZ(this Transform target, float endValue, float duration)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOScaleZ(this Transform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, 0, endValue), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, 0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Z)
|
t.SetOptions(AxisConstraint.Z)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Transform's rotation so that it will look towards the given position.
|
/// <summary>Tweens a Transform's rotation so that it will look towards the given position.
|
||||||
@ -950,9 +1015,11 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Tween's timeScale to the given value.
|
/// <summary>Tweens a Tween's timeScale to the given value.
|
||||||
/// Also stores the Tween as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Tween 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>
|
||||||
public static Tweener DOTimeScale(this Tween target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOTimeScale(this Tween target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.timeScale, x => target.timeScale = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.timeScale, x => target.timeScale = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -570,6 +570,8 @@ namespace DG.Tweening
|
|||||||
|
|
||||||
#region Tweeners-only
|
#region Tweeners-only
|
||||||
|
|
||||||
|
#region FROM
|
||||||
|
|
||||||
/// <summary>Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue
|
/// <summary>Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue
|
||||||
/// then immediately sends the target to the previously set endValue.</summary>
|
/// then immediately sends the target to the previously set endValue.</summary>
|
||||||
public static T From<T>(this T t) where T : Tweener
|
public static T From<T>(this T t) where T : Tweener
|
||||||
@ -593,6 +595,52 @@ namespace DG.Tweening
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
/// and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
/// <param name="fromValue">Value to start from</param>
|
||||||
|
/// <param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
public static TweenerCore<T1,T2,TPlugOptions> From<T1,T2,TPlugOptions>(this TweenerCore<T1,T2,TPlugOptions> t, T2 fromValue, bool setImmediately = true)
|
||||||
|
where TPlugOptions : struct, IPlugOptions
|
||||||
|
{
|
||||||
|
if (t == null || !t.active || t.creationLocked || !t.isFromAllowed) return t;
|
||||||
|
|
||||||
|
t.isFrom = true;
|
||||||
|
t.SetFrom(fromValue, setImmediately);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FROM Extra Overloads
|
||||||
|
|
||||||
|
/// <summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
/// and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
/// <param name="fromAlphaValue">Alpha value to start from (in case of Fade tweens)</param>
|
||||||
|
/// <param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
public static TweenerCore<DOColor, DOColor, ColorOptions> From(this TweenerCore<DOColor, DOColor, ColorOptions> t, float fromAlphaValue, bool setImmediately = true)
|
||||||
|
{
|
||||||
|
if (t == null || !t.active || t.creationLocked || !t.isFromAllowed) return t;
|
||||||
|
|
||||||
|
t.isFrom = true;
|
||||||
|
t.SetFrom(new Color(0,0,0,fromAlphaValue), setImmediately);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
/// and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
/// <param name="fromValue">Value to start from (in case of Vector tweens that act on a single coordinate or scale tweens)</param>
|
||||||
|
/// <param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
public static TweenerCore<DOVector3, DOVector3, VectorOptions> From(this TweenerCore<DOVector3, DOVector3, VectorOptions> t, float fromValue, bool setImmediately = true)
|
||||||
|
{
|
||||||
|
if (t == null || !t.active || t.creationLocked || !t.isFromAllowed) return t;
|
||||||
|
|
||||||
|
t.isFrom = true;
|
||||||
|
t.SetFrom(new Vector3(fromValue, fromValue, fromValue), setImmediately);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>Sets a delayed startup for the tween.
|
/// <summary>Sets a delayed startup for the tween.
|
||||||
/// <para>Has no effect on Sequences or if the tween has already started</para></summary>
|
/// <para>Has no effect on Sequences or if the tween has already started</para></summary>
|
||||||
public static T SetDelay<T>(this T t, float delay) where T : Tween
|
public static T SetDelay<T>(this T t, float delay) where T : Tween
|
||||||
|
|||||||
@ -273,6 +273,9 @@
|
|||||||
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.SetFrom(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},System.Boolean)">
|
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.SetFrom(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},System.Boolean)">
|
||||||
<summary>INTERNAL: do not use</summary>
|
<summary>INTERNAL: do not use</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.SetFrom(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},UnityEngine.Quaternion,System.Boolean)">
|
||||||
|
<summary>INTERNAL: do not use</summary>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.ConvertToStartValue(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},UnityEngine.Quaternion)">
|
<member name="M:DG.Tweening.CustomPlugins.PureQuaternionPlugin.ConvertToStartValue(DG.Tweening.Core.TweenerCore{UnityEngine.Quaternion,UnityEngine.Quaternion,DG.Tweening.Plugins.Options.NoOptions},UnityEngine.Quaternion)">
|
||||||
<summary>INTERNAL: do not use</summary>
|
<summary>INTERNAL: do not use</summary>
|
||||||
</member>
|
</member>
|
||||||
@ -2383,6 +2386,24 @@
|
|||||||
then immediately sends the target to the previously set endValue.</summary>
|
then immediately sends the target to the previously set endValue.</summary>
|
||||||
<param name="isRelative">If TRUE the FROM value will be calculated as relative to the current one</param>
|
<param name="isRelative">If TRUE the FROM value will be calculated as relative to the current one</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:DG.Tweening.TweenSettingsExtensions.From``3(DG.Tweening.Core.TweenerCore{``0,``1,``2},``1,System.Boolean)">
|
||||||
|
<summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
<param name="fromValue">Value to start from</param>
|
||||||
|
<param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.TweenSettingsExtensions.From(DG.Tweening.Core.TweenerCore{UnityEngine.Color,UnityEngine.Color,DG.Tweening.Plugins.Options.ColorOptions},System.Single,System.Boolean)">
|
||||||
|
<summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
<param name="fromAlphaValue">Alpha value to start from (in case of Fade tweens)</param>
|
||||||
|
<param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.TweenSettingsExtensions.From(DG.Tweening.Core.TweenerCore{UnityEngine.Vector3,UnityEngine.Vector3,DG.Tweening.Plugins.Options.VectorOptions},System.Single,System.Boolean)">
|
||||||
|
<summary>Changes a TO tween into a FROM tween: sets the tween's starting value to the given one
|
||||||
|
and eventually sets the tween's target to that value immediately.</summary>
|
||||||
|
<param name="fromValue">Value to start from (in case of Vector tweens that act on a single coordinate or scale tweens)</param>
|
||||||
|
<param name="setImmediately">If TRUE sets the target to from value immediately, otherwise waits for the tween to start</param>
|
||||||
|
</member>
|
||||||
<member name="M:DG.Tweening.TweenSettingsExtensions.SetDelay``1(``0,System.Single)">
|
<member name="M:DG.Tweening.TweenSettingsExtensions.SetDelay``1(``0,System.Single)">
|
||||||
<summary>Sets a delayed startup for the tween.
|
<summary>Sets a delayed startup for the tween.
|
||||||
<para>Has no effect on Sequences or if the tween has already started</para></summary>
|
<para>Has no effect on Sequences or if the tween has already started</para></summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#if true // MODULE_MARKER
|
#if true // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
#if UNITY_5 || UNITY_2017_1_OR_NEWER
|
#if UNITY_5 || UNITY_2017_1_OR_NEWER
|
||||||
using UnityEngine.Audio; // Required for AudioMixer
|
using UnityEngine.Audio; // Required for AudioMixer
|
||||||
@ -20,19 +22,23 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens an AudioSource's volume to the given value.
|
/// <summary>Tweens an AudioSource's volume to the given value.
|
||||||
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFade(this AudioSource target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFade(this AudioSource target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
if (endValue < 0) endValue = 0;
|
if (endValue < 0) endValue = 0;
|
||||||
else if (endValue > 1) endValue = 1;
|
else if (endValue > 1) endValue = 1;
|
||||||
return DOTween.To(() => target.volume, x => target.volume = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.volume, x => target.volume = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an AudioSource's pitch to the given value.
|
/// <summary>Tweens an AudioSource's pitch to the given value.
|
||||||
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the AudioSource 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>
|
||||||
public static Tweener DOPitch(this AudioSource target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOPitch(this AudioSource target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration).SetTarget(target);
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -45,14 +51,15 @@ namespace DG.Tweening
|
|||||||
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
|
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
|
||||||
/// <param name="floatName">Name given to the exposed float to set</param>
|
/// <param name="floatName">Name given to the exposed float to set</param>
|
||||||
/// <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>
|
||||||
public static Tweener DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(()=> {
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(()=> {
|
||||||
float currVal;
|
float currVal;
|
||||||
target.GetFloat(floatName, out currVal);
|
target.GetFloat(floatName, out currVal);
|
||||||
return currVal;
|
return currVal;
|
||||||
}, x=> target.SetFloat(floatName, x), endValue, duration)
|
}, x=> target.SetFloat(floatName, x), endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Operation Shortcuts
|
#region Operation Shortcuts
|
||||||
|
|||||||
@ -23,47 +23,51 @@ namespace DG.Tweening
|
|||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, endValue, duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's X position to the given value.
|
/// <summary>Tweens a Rigidbody's X position to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's Y position to the given value.
|
/// <summary>Tweens a Rigidbody's Y position to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's Z position to the given value.
|
/// <summary>Tweens a Rigidbody's Z position to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody's rotation to the given value.
|
/// <summary>Tweens a Rigidbody's rotation to the given value.
|
||||||
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the rigidbody 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>
|
||||||
/// <param name="mode">Rotation mode</param>
|
/// <param name="mode">Rotation mode</param>
|
||||||
public static Tweener DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
||||||
t.SetTarget(target);
|
t.SetTarget(target);
|
||||||
@ -76,7 +80,7 @@ namespace DG.Tweening
|
|||||||
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
|
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
|
||||||
/// <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>
|
||||||
public static Tweener DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
|
||||||
{
|
{
|
||||||
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
|
||||||
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
|
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER
|
#if true && (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1_OR_NEWER) // MODULE_MARKER
|
||||||
using System;
|
using System;
|
||||||
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
@ -18,39 +20,43 @@ namespace DG.Tweening
|
|||||||
/// 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's X position to the given value.
|
/// <summary>Tweens a Rigidbody2D's X position to the given value.
|
||||||
/// 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's Y position to the given value.
|
/// <summary>Tweens a Rigidbody2D's Y position to the given value.
|
||||||
/// 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Rigidbody2D's rotation to the given value.
|
/// <summary>Tweens a Rigidbody2D's rotation to the given value.
|
||||||
/// 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>
|
||||||
public static Tweener DORotate(this Rigidbody2D target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DORotate(this Rigidbody2D target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Special
|
#region Special
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
@ -18,18 +19,21 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a SpriteRenderer's color to the given value.
|
/// <summary>Tweens a SpriteRenderer's color to the given value.
|
||||||
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the spriteRenderer 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>
|
||||||
public static Tweener DOColor(this SpriteRenderer target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SpriteRenderer target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's alpha color to the given value.
|
/// <summary>Tweens a Material's alpha color to the given value.
|
||||||
/// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the spriteRenderer 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>
|
||||||
public static Tweener DOFade(this SpriteRenderer target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SpriteRenderer target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a SpriteRenderer's color using the given gradient
|
/// <summary>Tweens a SpriteRenderer's color using the given gradient
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Core.Enums;
|
using DG.Tweening.Core.Enums;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
@ -20,10 +21,11 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a CanvasGroup's alpha color to the given value.
|
/// <summary>Tweens a CanvasGroup's alpha color to the given value.
|
||||||
/// Also stores the canvasGroup as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the canvasGroup 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>
|
||||||
public static Tweener DOFade(this CanvasGroup target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFade(this CanvasGroup target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -33,18 +35,21 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens an Graphic's color to the given value.
|
/// <summary>Tweens an Graphic's color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOColor(this Graphic target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Graphic target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Graphic's alpha color to the given value.
|
/// <summary>Tweens an Graphic's alpha color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOFade(this Graphic target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Graphic target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -54,29 +59,33 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens an Image's color to the given value.
|
/// <summary>Tweens an Image's color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOColor(this Image target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Image target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Image's alpha color to the given value.
|
/// <summary>Tweens an Image's alpha color to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image 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>
|
||||||
public static Tweener DOFade(this Image target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Image target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Image's fillAmount to the given value.
|
/// <summary>Tweens an Image's fillAmount to the given value.
|
||||||
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the image as the tween's target so it can be used for filtered operations</summary>
|
||||||
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOFillAmount(this Image target, float endValue, float duration)
|
public static TweenerCore<float, float, FloatOptions> DOFillAmount(this Image target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
if (endValue > 1) endValue = 1;
|
if (endValue > 1) endValue = 1;
|
||||||
else if (endValue < 0) endValue = 0;
|
else if (endValue < 0) endValue = 0;
|
||||||
return DOTween.To(() => target.fillAmount, x => target.fillAmount = x, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.fillAmount, x => target.fillAmount = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an Image's colors using the given gradient
|
/// <summary>Tweens an Image's colors using the given gradient
|
||||||
@ -110,39 +119,42 @@ namespace DG.Tweening
|
|||||||
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the LayoutElement 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => {
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => {
|
||||||
target.flexibleWidth = x.x;
|
target.flexibleWidth = x.x;
|
||||||
target.flexibleHeight = x.y;
|
target.flexibleHeight = x.y;
|
||||||
}, endValue, duration)
|
}, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an LayoutElement's minWidth/Height to the given value.
|
/// <summary>Tweens an LayoutElement's minWidth/Height to the given value.
|
||||||
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the LayoutElement 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => {
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => {
|
||||||
target.minWidth = x.x;
|
target.minWidth = x.x;
|
||||||
target.minHeight = x.y;
|
target.minHeight = x.y;
|
||||||
}, endValue, duration)
|
}, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens an LayoutElement's preferredWidth/Height to the given value.
|
/// <summary>Tweens an LayoutElement's preferredWidth/Height to the given value.
|
||||||
/// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the LayoutElement 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => {
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => {
|
||||||
target.preferredWidth = x.x;
|
target.preferredWidth = x.x;
|
||||||
target.preferredHeight = x.y;
|
target.preferredHeight = x.y;
|
||||||
}, endValue, duration)
|
}, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -152,27 +164,31 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Outline's effectColor to the given value.
|
/// <summary>Tweens a Outline's effectColor to the given value.
|
||||||
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Outline 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>
|
||||||
public static Tweener DOColor(this Outline target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outline target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.effectColor, x => target.effectColor = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.effectColor, x => target.effectColor = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Outline's effectColor alpha to the given value.
|
/// <summary>Tweens a Outline's effectColor alpha to the given value.
|
||||||
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Outline 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>
|
||||||
public static Tweener DOFade(this Outline target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outline target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Outline's effectDistance to the given value.
|
/// <summary>Tweens a Outline's effectDistance to the given value.
|
||||||
/// Also stores the Outline as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Outline 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>
|
||||||
public static Tweener DOScale(this Outline target, Vector2 endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOScale(this Outline target, Vector2 endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -183,120 +199,133 @@ namespace DG.Tweening
|
|||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPos(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition X to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition X to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPosX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPosX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue, 0), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition Y to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition Y to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPosY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorPosY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, endValue), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3D(this RectTransform target, Vector3 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3D(this RectTransform target, Vector3 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, endValue, duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D X to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D X to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3DX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DX(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(endValue, 0, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(endValue, 0, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D Y to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D Y to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3DY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DY(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, endValue, 0), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's anchoredPosition3D Z to the given value.
|
/// <summary>Tweens a RectTransform's anchoredPosition3D Z to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorPos3DZ(this RectTransform target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector3, Vector3, VectorOptions> DOAnchorPos3DZ(this RectTransform target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, 0, endValue), duration)
|
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, 0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's anchorMax to the given value.
|
/// <summary>Tweens a RectTransform's anchorMax to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorMax(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorMax(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchorMax, x => target.anchorMax = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchorMax, x => target.anchorMax = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's anchorMin to the given value.
|
/// <summary>Tweens a RectTransform's anchorMin to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOAnchorMin(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOAnchorMin(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.anchorMin, x => target.anchorMin = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.anchorMin, x => target.anchorMin = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's pivot to the given value.
|
/// <summary>Tweens a RectTransform's pivot to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
public static Tweener DOPivot(this RectTransform target, Vector2 endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivot(this RectTransform target, Vector2 endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pivot, x => target.pivot = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's pivot X to the given value.
|
/// <summary>Tweens a RectTransform's pivot X to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
public static Tweener DOPivotX(this RectTransform target, float endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivotX(this RectTransform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(endValue, 0), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(endValue, 0), duration);
|
||||||
.SetOptions(AxisConstraint.X).SetTarget(target);
|
t.SetOptions(AxisConstraint.X).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Tweens a RectTransform's pivot Y to the given value.
|
/// <summary>Tweens a RectTransform's pivot Y to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
public static Tweener DOPivotY(this RectTransform target, float endValue, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPivotY(this RectTransform target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(0, endValue), duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(0, endValue), duration);
|
||||||
.SetOptions(AxisConstraint.Y).SetTarget(target);
|
t.SetOptions(AxisConstraint.Y).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a RectTransform's sizeDelta to the given value.
|
/// <summary>Tweens a RectTransform's sizeDelta to the given value.
|
||||||
/// Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the RectTransform 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOSizeDelta(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOSizeDelta(this RectTransform target, Vector2 endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.sizeDelta, x => target.sizeDelta = x, endValue, duration)
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.sizeDelta, x => target.sizeDelta = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Punches a RectTransform's anchoredPosition towards the given direction and then back to the starting one
|
/// <summary>Punches a RectTransform's anchoredPosition towards the given direction and then back to the starting one
|
||||||
@ -430,10 +459,11 @@ namespace DG.Tweening
|
|||||||
/// Also stores the Slider as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Slider 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>
|
||||||
/// <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>
|
||||||
public static Tweener DOValue(this Slider target, float endValue, float duration, bool snapping = false)
|
public static TweenerCore<float, float, FloatOptions> DOValue(this Slider target, float endValue, float duration, bool snapping = false)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.value, x => target.value = x, endValue, duration)
|
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.value, x => target.value = x, endValue, duration);
|
||||||
.SetOptions(snapping).SetTarget(target);
|
t.SetOptions(snapping).SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -443,18 +473,21 @@ namespace DG.Tweening
|
|||||||
/// <summary>Tweens a Text's color to the given value.
|
/// <summary>Tweens a Text's color to the given value.
|
||||||
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Text 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>
|
||||||
public static Tweener DOColor(this Text target, Color endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Text target, Color endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.To(() => target.color, x => target.color = x, endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Text's alpha color to the given value.
|
/// <summary>Tweens a Text's alpha color to the given value.
|
||||||
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
|
/// Also stores the Text 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>
|
||||||
public static Tweener DOFade(this Text target, float endValue, float duration)
|
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Text target, float endValue, float duration)
|
||||||
{
|
{
|
||||||
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
|
TweenerCore<Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);
|
||||||
.SetTarget(target);
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Text's text to the given value.
|
/// <summary>Tweens a Text's text to the given value.
|
||||||
@ -466,11 +499,12 @@ namespace DG.Tweening
|
|||||||
/// <param name="scrambleChars">A string containing the characters to use for scrambling.
|
/// <param name="scrambleChars">A string containing the characters to use for scrambling.
|
||||||
/// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
|
/// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
|
||||||
/// Leave it to NULL (default) to use default ones</param>
|
/// Leave it to NULL (default) to use default ones</param>
|
||||||
public static Tweener DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
|
public static TweenerCore<string, string, StringOptions> DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
|
||||||
{
|
{
|
||||||
return DOTween.To(() => target.text, x => target.text = x, endValue, duration)
|
TweenerCore<string, string, StringOptions> t = DOTween.To(() => target.text, x => target.text = x, endValue, duration);
|
||||||
.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
|
t.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
|
||||||
.SetTarget(target);
|
.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening
|
namespace DG.Tweening
|
||||||
@ -178,13 +179,15 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tweens a Material's named texture scale property with the given ID to the given value.
|
/// <summary>Tweens a Material's named texture scale property with the given ID to the given value.
|
||||||
@ -192,13 +195,15 @@ namespace DG.Tweening
|
|||||||
/// <param name="endValue">The end value to reach</param>
|
/// <param name="endValue">The end value to reach</param>
|
||||||
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
/// <param name="propertyID">The ID of the material property to tween (also called nameID in Unity's manual)</param>
|
||||||
/// <param name="duration">The duration of the tween</param>
|
/// <param name="duration">The duration of the tween</param>
|
||||||
public static Tweener DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
|
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||||
{
|
{
|
||||||
if (!target.HasProperty(propertyID)) {
|
if (!target.HasProperty(propertyID)) {
|
||||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration).SetTarget(target);
|
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration);
|
||||||
|
t.SetTarget(target);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user