diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML
index e4412c6..33c9717 100644
--- a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML
+++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML
@@ -2040,16 +2040,22 @@
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual overshoot to use with Back ease (default is 1.70158).
+ Eventual overshoot to use with Back or Flash ease (default is 1.70158).
In case of Flash ease it sets the total number of flashes that will happen.
- Using an even number will end the tween on the starting value, while an odd one will end on the end value.
+ Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual amplitude to use with Elastic easeType (default is 1.70158)
- Eventual period to use with Elastic easeType (default is 0)
+ Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
+ In case of Flash ease it 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.
+
+ Eventual period to use with Elastic or Flash easeType (default is 0).
+ In case of Flash ease it indicates the power in time of the ease, and must be between -1 and 1.
+ 0 is balanced, 1 weakens the ease with time, -1 starts the ease weakened and gives it power towards the end.
+
Sets the ease of the tween using an AnimationCurve.
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll
index 77607d0..80321e9 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb
index 44ced81..31f0790 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll
index 61ae52b..e5409d7 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb
index e9feb5d..f81849d 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll
index cbbf5e3..2548316 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb
index 79747ec..3c8a205 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll
index 9179775..c6a03a1 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb
index fc94a46..094836f 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween50.dll.mdb differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll
index b775192..e355c0c 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ
diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb
index 731e179..5300dcf 100644
Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML
index e4412c6..33c9717 100644
--- a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML
+++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML
@@ -2040,16 +2040,22 @@
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual overshoot to use with Back ease (default is 1.70158).
+ Eventual overshoot to use with Back or Flash ease (default is 1.70158).
In case of Flash ease it sets the total number of flashes that will happen.
- Using an even number will end the tween on the starting value, while an odd one will end on the end value.
+ Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual amplitude to use with Elastic easeType (default is 1.70158)
- Eventual period to use with Elastic easeType (default is 0)
+ Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
+ In case of Flash ease it 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.
+
+ Eventual period to use with Elastic or Flash easeType (default is 0).
+ In case of Flash ease it indicates the power in time of the ease, and must be between -1 and 1.
+ 0 is balanced, 1 weakens the ease with time, -1 starts the ease weakened and gives it power towards the end.
+
Sets the ease of the tween using an AnimationCurve.
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll
index 77607d0..80321e9 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb
index 44ced81..31f0790 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll
index 61ae52b..e5409d7 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb
index e9feb5d..f81849d 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll
index cbbf5e3..2548316 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb
index 79747ec..3c8a205 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll
index 9179775..c6a03a1 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb
index fc94a46..094836f 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll
index b775192..e355c0c 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ
diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb
index 731e179..5300dcf 100644
Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML
index e4412c6..33c9717 100644
--- a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML
+++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML
@@ -2040,16 +2040,22 @@
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual overshoot to use with Back ease (default is 1.70158).
+ Eventual overshoot to use with Back or Flash ease (default is 1.70158).
In case of Flash ease it sets the total number of flashes that will happen.
- Using an even number will end the tween on the starting value, while an odd one will end on the end value.
+ Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual amplitude to use with Elastic easeType (default is 1.70158)
- Eventual period to use with Elastic easeType (default is 0)
+ Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
+ In case of Flash ease it 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.
+
+ Eventual period to use with Elastic or Flash easeType (default is 0).
+ In case of Flash ease it indicates the power in time of the ease, and must be between -1 and 1.
+ 0 is balanced, 1 weakens the ease with time, -1 starts the ease weakened and gives it power towards the end.
+
Sets the ease of the tween using an AnimationCurve.
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll
index 77607d0..80321e9 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb
index 44ced81..31f0790 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll
index 61ae52b..e5409d7 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb
index e9feb5d..f81849d 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll
index cbbf5e3..2548316 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb
index 79747ec..3c8a205 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll
index 9179775..c6a03a1 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb
index fc94a46..094836f 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll
index b775192..e355c0c 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll differ
diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb
index 731e179..5300dcf 100644
Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/Editor/DOTweenEditor.dll.mdb differ
diff --git a/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs b/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs
index 4b29043..1207089 100644
--- a/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs
+++ b/UnityTests.Unity5/Assets/_Tests/EaseCurves.cs
@@ -10,6 +10,8 @@ public class EaseCurves : BrainBase
public AnimationCurve easeCurve;
public float tweenDuration = 1;
public int txDistance = 2;
+ public float easeFlashOvershoot = 16;
+ public float easeFlashPeriod = 1;
int txH, txW;
int txBorder, easeH;
@@ -75,10 +77,10 @@ public class EaseCurves : BrainBase
img.GetComponentInChildren().text = easeType.ToString();
if (easeType == Ease.INTERNAL_Custom) tween.SetEase(easeCurve);
else{
- float overshootOrAmplitude = easeType.ToString().IndexOf("Flash") == -1
- ? DOTween.defaultEaseOvershootOrAmplitude
- : 16;
- tween.SetEase(easeType, overshootOrAmplitude);
+ bool isFlashEase = easeType.ToString().IndexOf("Flash") != -1;
+ float overshootOrAmplitude = isFlashEase ? easeFlashOvershoot : DOTween.defaultEaseOvershootOrAmplitude;
+ float period = isFlashEase ? easeFlashPeriod : DOTween.defaultEasePeriod;
+ tween.SetEase(easeType, overshootOrAmplitude, period);
}
}
}
diff --git a/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity b/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity
index 12f70e5..a18af2c 100644
Binary files a/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity and b/UnityTests.Unity5/Assets/_Tests/EaseCurves.unity differ
diff --git a/UnityTests.Unity5/Assets/_Tests/EaseX.cs b/UnityTests.Unity5/Assets/_Tests/EaseX.cs
index b14e4e0..efb66e8 100644
--- a/UnityTests.Unity5/Assets/_Tests/EaseX.cs
+++ b/UnityTests.Unity5/Assets/_Tests/EaseX.cs
@@ -10,14 +10,15 @@ public class EaseX : MonoBehaviour
[Header("Tween Settings")]
public float duration = 2;
public Ease ease;
- public float overshootOrAmplitude = 10;
+ public float overshootOrAmplitude = 16;
+ public float period = 1;
public void Play()
{
DOTween.RewindAll();
DOTween.KillAll();
- imgFlash.DOColor(flashColor, duration).SetEase(ease, overshootOrAmplitude);
- imgSmoothFlash.DOColor(flashColor, duration).SetEase(ease, overshootOrAmplitude);
+ imgFlash.DOColor(flashColor, duration).SetEase(ease, overshootOrAmplitude, period);
+ imgSmoothFlash.DOColor(flashColor, duration).SetEase(ease, overshootOrAmplitude - 1, period);
}
}
\ No newline at end of file
diff --git a/UnityTests.Unity5/Assets/_Tests/EaseX.unity b/UnityTests.Unity5/Assets/_Tests/EaseX.unity
index 3744cc7..53eccf6 100644
Binary files a/UnityTests.Unity5/Assets/_Tests/EaseX.unity and b/UnityTests.Unity5/Assets/_Tests/EaseX.unity differ
diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/EaseFlash_curves.png b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/EaseFlash_curves.png
index bf379fb..a9e50fb 100644
Binary files a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/EaseFlash_curves.png and b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/EaseFlash_curves.png differ
diff --git a/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs
index 6ddb7bf..6afd236 100644
--- a/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs
+++ b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs
@@ -61,10 +61,6 @@ namespace DG.Tweening.Core.Easing
///
public static float Evaluate(Ease easeType, EaseFunction customEase, float time, float duration, float overshootOrAmplitude, float period)
{
- int stepIndex;
- float stepDuration;
- int dir;
-
switch (easeType) {
case Ease.Linear:
return time / duration;
@@ -171,79 +167,13 @@ namespace DG.Tweening.Core.Easing
// Extra custom eases ////////////////////////////////////////////////////
case Ease.Flash:
-// stepIndex = Mathf.CeilToInt((time / duration) * overshootOrAmplitude); // 1 to overshootOrAmplitude
-// stepDuration = duration / overshootOrAmplitude;
-// time -= stepDuration * (stepIndex - 1);
-// dir = (stepIndex % 2 != 0) ? 1 : - 1;
-// if (dir < 0) time -= stepDuration;
-// float res = (time * dir) / stepDuration;
-// if (period > 0) {
-// float easedRes = (res * (overshootOrAmplitude - stepIndex)) / overshootOrAmplitude;
-// float diff = easedRes - res;
-// diff = diff * period;
-// return res + diff;
-// }
-// if (period < 0) {
-// period = -period;
-// float easedRes = (res * stepIndex) / overshootOrAmplitude;
-// float diff = easedRes - res;
-// diff = diff * period;
-// return res + diff;
-// }
-// return res;
-
- float final = 0;
- stepIndex = Mathf.CeilToInt((time / duration) * overshootOrAmplitude); // 1 to overshootOrAmplitude
- stepDuration = duration / overshootOrAmplitude;
- time -= stepDuration * (stepIndex - 1);
- dir = (stepIndex % 2 != 0) ? 1 : - 1;
- if (dir < 0) time -= stepDuration;
- float res = (time * dir) / stepDuration;
- float easedRes = 0;
- if (period > 0) {
- final = overshootOrAmplitude - (float)Math.Truncate(overshootOrAmplitude);
- if ((float)Math.Truncate(overshootOrAmplitude) % 2 > 0) final = 1 - final;
- final = (final * stepIndex) / overshootOrAmplitude;
- easedRes = (res * (overshootOrAmplitude - stepIndex)) / overshootOrAmplitude;
- } else if (period < 0) {
- period = -period;
- easedRes = (res * stepIndex) / overshootOrAmplitude;
- }
- float diff = easedRes - res;
- res += (diff * period) + final;
- if (res > 1) res = 1;
- return res;
+ return Flash.Ease(time, duration, overshootOrAmplitude, period);
case Ease.InFlash:
- stepDuration = duration / overshootOrAmplitude;
- dir = 1;
- while (time > stepDuration) {
- time -= stepDuration;
- dir = -dir;
- }
- if (dir < 0) time -= stepDuration;
- time = time * dir;
- return (time /= stepDuration) * time;
+ return Flash.EaseIn(time, duration, overshootOrAmplitude, period);
case Ease.OutFlash:
- stepDuration = duration / overshootOrAmplitude;
- dir = 1;
- while (time > stepDuration) {
- time -= stepDuration;
- dir = -dir;
- }
- if (dir < 0) time -= stepDuration;
- time = time * dir;
- return -(time /= stepDuration) * (time - 2);
+ return Flash.EaseOut(time, duration, overshootOrAmplitude, period);
case Ease.InOutFlash:
- stepDuration = duration / overshootOrAmplitude;
- dir = 1;
- while (time > stepDuration) {
- time -= stepDuration;
- dir = -dir;
- }
- if (dir < 0) time -= stepDuration;
- time = time * dir;
- if ((time /= stepDuration * 0.5f) < 1) return 0.5f * time * time;
- return -0.5f * ((--time) * (time - 2) - 1);
+ return Flash.EaseInOut(time, duration, overshootOrAmplitude, period);
// Default
default:
@@ -254,9 +184,6 @@ namespace DG.Tweening.Core.Easing
public static EaseFunction ToEaseFunction(Ease ease)
{
- float durationStep;
- int dir;
-
switch (ease) {
case Ease.Linear:
return (float time, float duration, float overshootOrAmplitude, float period) =>
@@ -400,53 +327,17 @@ namespace DG.Tweening.Core.Easing
// Extra custom eases ////////////////////////////////////////////////////
case Ease.Flash:
- return (float time, float duration, float overshootOrAmplitude, float period) => {
- durationStep = duration / overshootOrAmplitude;
- dir = 1;
- while (time > durationStep) {
- time -= durationStep;
- dir = -dir;
- }
- if (dir < 0) time -= durationStep;
- return (time * dir) / durationStep;
- };
+ return (float time, float duration, float overshootOrAmplitude, float period) =>
+ Flash.Ease(time, duration, overshootOrAmplitude, period);
case Ease.InFlash:
- return (float time, float duration, float overshootOrAmplitude, float period) => {
- durationStep = duration / overshootOrAmplitude;
- dir = 1;
- while (time > durationStep) {
- time -= durationStep;
- dir = -dir;
- }
- if (dir < 0) time -= durationStep;
- time = time * dir;
- return (time /= durationStep) * time;
- };
+ return (float time, float duration, float overshootOrAmplitude, float period) =>
+ Flash.EaseIn(time, duration, overshootOrAmplitude, period);
case Ease.OutFlash:
- return (float time, float duration, float overshootOrAmplitude, float period) => {
- durationStep = duration / overshootOrAmplitude;
- dir = 1;
- while (time > durationStep) {
- time -= durationStep;
- dir = -dir;
- }
- if (dir < 0) time -= durationStep;
- time = time * dir;
- return -(time /= durationStep) * (time - 2);
- };
+ return (float time, float duration, float overshootOrAmplitude, float period) =>
+ Flash.EaseOut(time, duration, overshootOrAmplitude, period);
case Ease.InOutFlash:
- return (float time, float duration, float overshootOrAmplitude, float period) => {
- durationStep = duration / overshootOrAmplitude;
- dir = 1;
- while (time > durationStep) {
- time -= durationStep;
- dir = -dir;
- }
- if (dir < 0) time -= durationStep;
- time = time * dir;
- if ((time /= durationStep * 0.5f) < 1) return 0.5f * time * time;
- return -0.5f * ((--time) * (time - 2) - 1);
- };
+ return (float time, float duration, float overshootOrAmplitude, float period) =>
+ Flash.EaseInOut(time, duration, overshootOrAmplitude, period);
// Default
default:
diff --git a/_DOTween.Assembly/DOTween/Core/Easing/Flash.cs b/_DOTween.Assembly/DOTween/Core/Easing/Flash.cs
new file mode 100644
index 0000000..077fb2e
--- /dev/null
+++ b/_DOTween.Assembly/DOTween/Core/Easing/Flash.cs
@@ -0,0 +1,83 @@
+// Author: Daniele Giardini - http://www.demigiant.com
+// Created: 2015/10/31 15:59
+// License Copyright (c) Daniele Giardini
+// This work is subject to the terms at http://dotween.demigiant.com/license.php
+
+using System;
+using UnityEngine;
+
+#pragma warning disable 1591
+namespace DG.Tweening.Core.Easing
+{
+ public static class Flash
+ {
+ public static float Ease(float time, float duration, float overshootOrAmplitude, float period)
+ {
+ int stepIndex = Mathf.CeilToInt((time / duration) * overshootOrAmplitude); // 1 to overshootOrAmplitude
+ float stepDuration = duration / overshootOrAmplitude;
+ time -= stepDuration * (stepIndex - 1);
+ float dir = (stepIndex % 2 != 0) ? 1 : -1;
+ if (dir < 0) time -= stepDuration;
+ float res = (time * dir) / stepDuration;
+ return WeightedEase(overshootOrAmplitude, period, stepIndex, stepDuration, dir, res);
+ }
+
+ public static float EaseIn(float time, float duration, float overshootOrAmplitude, float period)
+ {
+ int stepIndex = Mathf.CeilToInt((time / duration) * overshootOrAmplitude); // 1 to overshootOrAmplitude
+ float stepDuration = duration / overshootOrAmplitude;
+ time -= stepDuration * (stepIndex - 1);
+ float dir = (stepIndex % 2 != 0) ? 1 : -1;
+ if (dir < 0) time -= stepDuration;
+ time = time * dir;
+ float res = (time /= stepDuration) * time;
+ return WeightedEase(overshootOrAmplitude, period, stepIndex, stepDuration, dir, res);
+ }
+
+ public static float EaseOut(float time, float duration, float overshootOrAmplitude, float period)
+ {
+ int stepIndex = Mathf.CeilToInt((time / duration) * overshootOrAmplitude); // 1 to overshootOrAmplitude
+ float stepDuration = duration / overshootOrAmplitude;
+ time -= stepDuration * (stepIndex - 1);
+ float dir = (stepIndex % 2 != 0) ? 1 : -1;
+ if (dir < 0) time -= stepDuration;
+ time = time * dir;
+ float res = -(time /= stepDuration) * (time - 2);
+ return WeightedEase(overshootOrAmplitude, period, stepIndex, stepDuration, dir, res);
+ }
+
+ public static float EaseInOut(float time, float duration, float overshootOrAmplitude, float period)
+ {
+ int stepIndex = Mathf.CeilToInt((time / duration) * overshootOrAmplitude); // 1 to overshootOrAmplitude
+ float stepDuration = duration / overshootOrAmplitude;
+ time -= stepDuration * (stepIndex - 1);
+ float dir = (stepIndex % 2 != 0) ? 1 : -1;
+ if (dir < 0) time -= stepDuration;
+ time = time * dir;
+ float res = (time /= stepDuration * 0.5f) < 1
+ ? 0.5f * time * time
+ : -0.5f * ((--time) * (time - 2) - 1);
+ return WeightedEase(overshootOrAmplitude, period, stepIndex, stepDuration, dir, res);
+ }
+
+ static float WeightedEase(float overshootOrAmplitude, float period, int stepIndex, float stepDuration, float dir, float res)
+ {
+ float easedRes = 0;
+ float finalDecimals = 0;
+ if (period > 0) {
+ float finalTruncated = (float)Math.Truncate(overshootOrAmplitude);
+ finalDecimals = overshootOrAmplitude - finalTruncated;
+ if (finalTruncated % 2 > 0) finalDecimals = 1 - finalDecimals;
+ finalDecimals = (finalDecimals * stepIndex) / overshootOrAmplitude;
+ easedRes = (res * (overshootOrAmplitude - stepIndex)) / overshootOrAmplitude;
+ } else if (period < 0) {
+ period = -period;
+ easedRes = (res * stepIndex) / overshootOrAmplitude;
+ }
+ float diff = easedRes - res;
+ res += (diff * period) + finalDecimals;
+ if (res > 1) res = 1;
+ return res;
+ }
+ }
+}
\ No newline at end of file
diff --git a/_DOTween.Assembly/DOTween/DOTween.csproj b/_DOTween.Assembly/DOTween/DOTween.csproj
index 0dab61c..5710615 100644
--- a/_DOTween.Assembly/DOTween/DOTween.csproj
+++ b/_DOTween.Assembly/DOTween/DOTween.csproj
@@ -65,6 +65,7 @@
+
diff --git a/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs
index 538cbb0..19ed57b 100644
--- a/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs
+++ b/_DOTween.Assembly/DOTween/TweenSettingsExtensions.cs
@@ -127,9 +127,9 @@ namespace DG.Tweening
/// Sets the ease of the tween.
/// If applied to Sequences eases the whole sequence animation
///
- /// Eventual overshoot to use with Back ease (default is 1.70158).
+ /// Eventual overshoot to use with Back or Flash ease (default is 1.70158).
/// In case of Flash ease it sets the total number of flashes that will happen.
- /// Using an even number will end the tween on the starting value, while an odd one will end on the end value.
+ /// Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.
///
public static T SetEase(this T t, Ease ease, float overshoot) where T : Tween
{
@@ -142,8 +142,14 @@ namespace DG.Tweening
}
/// Sets the ease of the tween.
/// If applied to Sequences eases the whole sequence animation
- /// Eventual amplitude to use with Elastic easeType (default is 1.70158)
- /// Eventual period to use with Elastic easeType (default is 0)
+ /// Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
+ /// In case of Flash ease it 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.
+ ///
+ /// Eventual period to use with Elastic or Flash easeType (default is 0).
+ /// In case of Flash ease it indicates the power in time of the ease, and must be between -1 and 1.
+ /// 0 is balanced, 1 weakens the ease with time, -1 starts the ease weakened and gives it power towards the end.
+ ///
public static T SetEase(this T t, Ease ease, float amplitude, float period) where T : Tween
{
if (t == null || !t.active) return t;
diff --git a/_DOTween.Assembly/bin/DOTween.XML b/_DOTween.Assembly/bin/DOTween.XML
index e4412c6..33c9717 100644
--- a/_DOTween.Assembly/bin/DOTween.XML
+++ b/_DOTween.Assembly/bin/DOTween.XML
@@ -2040,16 +2040,22 @@
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual overshoot to use with Back ease (default is 1.70158).
+ Eventual overshoot to use with Back or Flash ease (default is 1.70158).
In case of Flash ease it sets the total number of flashes that will happen.
- Using an even number will end the tween on the starting value, while an odd one will end on the end value.
+ Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value.
Sets the ease of the tween.
If applied to Sequences eases the whole sequence animation
- Eventual amplitude to use with Elastic easeType (default is 1.70158)
- Eventual period to use with Elastic easeType (default is 0)
+ Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158).
+ In case of Flash ease it 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.
+
+ Eventual period to use with Elastic or Flash easeType (default is 0).
+ In case of Flash ease it indicates the power in time of the ease, and must be between -1 and 1.
+ 0 is balanced, 1 weakens the ease with time, -1 starts the ease weakened and gives it power towards the end.
+
Sets the ease of the tween using an AnimationCurve.
diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll
index 77607d0..80321e9 100644
Binary files a/_DOTween.Assembly/bin/DOTween.dll and b/_DOTween.Assembly/bin/DOTween.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween.dll.mdb b/_DOTween.Assembly/bin/DOTween.dll.mdb
index 44ced81..31f0790 100644
Binary files a/_DOTween.Assembly/bin/DOTween.dll.mdb and b/_DOTween.Assembly/bin/DOTween.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/DOTween43.dll b/_DOTween.Assembly/bin/DOTween43.dll
index 61ae52b..e5409d7 100644
Binary files a/_DOTween.Assembly/bin/DOTween43.dll and b/_DOTween.Assembly/bin/DOTween43.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween43.dll.mdb b/_DOTween.Assembly/bin/DOTween43.dll.mdb
index e9feb5d..f81849d 100644
Binary files a/_DOTween.Assembly/bin/DOTween43.dll.mdb and b/_DOTween.Assembly/bin/DOTween43.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/DOTween46.dll b/_DOTween.Assembly/bin/DOTween46.dll
index cbbf5e3..2548316 100644
Binary files a/_DOTween.Assembly/bin/DOTween46.dll and b/_DOTween.Assembly/bin/DOTween46.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween46.dll.mdb b/_DOTween.Assembly/bin/DOTween46.dll.mdb
index 79747ec..3c8a205 100644
Binary files a/_DOTween.Assembly/bin/DOTween46.dll.mdb and b/_DOTween.Assembly/bin/DOTween46.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/DOTween50.dll b/_DOTween.Assembly/bin/DOTween50.dll
index 9179775..c6a03a1 100644
Binary files a/_DOTween.Assembly/bin/DOTween50.dll and b/_DOTween.Assembly/bin/DOTween50.dll differ
diff --git a/_DOTween.Assembly/bin/DOTween50.dll.mdb b/_DOTween.Assembly/bin/DOTween50.dll.mdb
index fc94a46..094836f 100644
Binary files a/_DOTween.Assembly/bin/DOTween50.dll.mdb and b/_DOTween.Assembly/bin/DOTween50.dll.mdb differ
diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll
index b775192..e355c0c 100644
Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll differ
diff --git a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb
index 731e179..5300dcf 100644
Binary files a/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb and b/_DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb differ