mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 09:16:02 +08:00
Fix for Flash ease not appearing fluid when moving slowly
This commit is contained in:
parent
c3c28dd915
commit
85d2e96502
@ -2040,16 +2040,16 @@
|
|||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="overshoot">
|
<param name="overshoot">
|
||||||
Eventual overshoot to use with Back or Flash ease (default is 1.70158).
|
Eventual overshoot to use with Back or Flash ease (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an intenger and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
|
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an integer and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2040,16 +2040,16 @@
|
|||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="overshoot">
|
<param name="overshoot">
|
||||||
Eventual overshoot to use with Back or Flash ease (default is 1.70158).
|
Eventual overshoot to use with Back or Flash ease (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an intenger and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
|
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an integer and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2040,16 +2040,16 @@
|
|||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="overshoot">
|
<param name="overshoot">
|
||||||
Eventual overshoot to use with Back or Flash ease (default is 1.70158).
|
Eventual overshoot to use with Back or Flash ease (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an intenger and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
|
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an integer and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -10,11 +10,15 @@ using UnityEngine.UI;
|
|||||||
public class TempTests : BrainBase
|
public class TempTests : BrainBase
|
||||||
{
|
{
|
||||||
public Transform target;
|
public Transform target;
|
||||||
|
public float duration = 8;
|
||||||
|
public Ease ease;
|
||||||
|
public float amplitude = 8;
|
||||||
|
public float period = 1;
|
||||||
|
|
||||||
IEnumerator Start()
|
IEnumerator Start()
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(0.5f);
|
yield return new WaitForSeconds(0.5f);
|
||||||
|
|
||||||
target.DOMoveY(2, 5).SetRelative().SetEase(Ease.InOutFlash, 8, 1);
|
target.DOMoveY(2, duration).SetRelative().SetEase(ease, amplitude, period);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -345,5 +345,17 @@ namespace DG.Tweening.Core.Easing
|
|||||||
return (float time, float duration, float overshootOrAmplitude, float period) => -(time /= duration) * (time - 2);
|
return (float time, float duration, float overshootOrAmplitude, float period) => -(time /= duration) * (time - 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool IsFlashEase(Ease ease)
|
||||||
|
{
|
||||||
|
switch (ease) {
|
||||||
|
case Ease.Flash:
|
||||||
|
case Ease.InFlash:
|
||||||
|
case Ease.OutFlash:
|
||||||
|
case Ease.InOutFlash:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,6 +64,10 @@ namespace DG.Tweening.Core.Easing
|
|||||||
{
|
{
|
||||||
float easedRes = 0;
|
float easedRes = 0;
|
||||||
float finalDecimals = 0;
|
float finalDecimals = 0;
|
||||||
|
// Use previous stepIndex in case of odd ones, so that back ease is not clamped
|
||||||
|
if (dir > 0 && (int)overshootOrAmplitude % 2 == 0) stepIndex++;
|
||||||
|
else if (dir < 0 && (int)overshootOrAmplitude % 2 != 0) stepIndex++;
|
||||||
|
|
||||||
if (period > 0) {
|
if (period > 0) {
|
||||||
float finalTruncated = (float)Math.Truncate(overshootOrAmplitude);
|
float finalTruncated = (float)Math.Truncate(overshootOrAmplitude);
|
||||||
finalDecimals = overshootOrAmplitude - finalTruncated;
|
finalDecimals = overshootOrAmplitude - finalTruncated;
|
||||||
|
|||||||
@ -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.1.140";
|
public static readonly string Version = "1.1.145";
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
@ -121,14 +121,16 @@ namespace DG.Tweening
|
|||||||
if (t == null || !t.active) return t;
|
if (t == null || !t.active) return t;
|
||||||
|
|
||||||
t.easeType = ease;
|
t.easeType = ease;
|
||||||
|
if (EaseManager.IsFlashEase(ease)) t.easeOvershootOrAmplitude = (int)t.easeOvershootOrAmplitude;
|
||||||
|
|
||||||
t.customEase = null;
|
t.customEase = null;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Sets the ease of the tween.
|
/// <summary>Sets the ease of the tween.
|
||||||
/// <para>If applied to Sequences eases the whole sequence animation</para></summary>
|
/// <para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
/// <param name="overshoot">
|
/// <param name="overshoot">
|
||||||
/// Eventual overshoot to use with Back or Flash ease (default is 1.70158).
|
/// Eventual overshoot to use with Back or Flash ease (default is 1.70158 - 1 for Flash).
|
||||||
/// <para>In case of Flash ease it sets the total number of flashes that will happen.
|
/// <para>In case of Flash ease it must be an intenger and sets the total number of flashes that will happen.
|
||||||
/// Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
/// Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
/// </param>
|
/// </param>
|
||||||
public static T SetEase<T>(this T t, Ease ease, float overshoot) where T : Tween
|
public static T SetEase<T>(this T t, Ease ease, float overshoot) where T : Tween
|
||||||
@ -136,14 +138,15 @@ namespace DG.Tweening
|
|||||||
if (t == null || !t.active) return t;
|
if (t == null || !t.active) return t;
|
||||||
|
|
||||||
t.easeType = ease;
|
t.easeType = ease;
|
||||||
|
if (EaseManager.IsFlashEase(ease)) overshoot = (int)overshoot;
|
||||||
t.easeOvershootOrAmplitude = overshoot;
|
t.easeOvershootOrAmplitude = overshoot;
|
||||||
t.customEase = null;
|
t.customEase = null;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
/// <summary>Sets the ease of the tween.
|
/// <summary>Sets the ease of the tween.
|
||||||
/// <para>If applied to Sequences eases the whole sequence animation</para></summary>
|
/// <para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
/// <param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
|
/// <param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158 - 1 for Flash).
|
||||||
/// <para>In case of Flash ease it sets the total number of flashes that will happen.
|
/// <para>In case of Flash ease it must be an integer and sets the total number of flashes that will happen.
|
||||||
/// Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
/// Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
/// <param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
||||||
@ -155,6 +158,7 @@ namespace DG.Tweening
|
|||||||
if (t == null || !t.active) return t;
|
if (t == null || !t.active) return t;
|
||||||
|
|
||||||
t.easeType = ease;
|
t.easeType = ease;
|
||||||
|
if (EaseManager.IsFlashEase(ease)) amplitude = (int)amplitude;
|
||||||
t.easeOvershootOrAmplitude = amplitude;
|
t.easeOvershootOrAmplitude = amplitude;
|
||||||
t.easePeriod = period;
|
t.easePeriod = period;
|
||||||
t.customEase = null;
|
t.customEase = null;
|
||||||
|
|||||||
@ -2040,16 +2040,16 @@
|
|||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="overshoot">
|
<param name="overshoot">
|
||||||
Eventual overshoot to use with Back or Flash ease (default is 1.70158).
|
Eventual overshoot to use with Back or Flash ease (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an intenger and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
<member name="M:DG.Tweening.TweenSettingsExtensions.SetEase``1(``0,DG.Tweening.Ease,System.Single,System.Single)">
|
||||||
<summary>Sets the ease of the tween.
|
<summary>Sets the ease of the tween.
|
||||||
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
<para>If applied to Sequences eases the whole sequence animation</para></summary>
|
||||||
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
|
<param name="amplitude">Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158 - 1 for Flash).
|
||||||
<para>In case of Flash ease it sets the total number of flashes that will happen.
|
<para>In case of Flash ease it must be an integer and sets the total number of flashes that will happen.
|
||||||
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.</para>
|
||||||
</param>
|
</param>
|
||||||
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
<param name="period">Eventual period to use with Elastic or Flash easeType (default is 0).
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user