diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML index bd3c14c..1567aac 100644 --- a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML @@ -1759,6 +1759,32 @@ Path plugin works exclusively with Transforms + + + Allows to wrap ease method in special ways, adding extra features + + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Ease type + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + AnimationCurve to use for the ease + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Custom ease function to use + Types of loop @@ -1862,6 +1888,7 @@ Used to interpret AnimationCurves as eases. + Public so it can be used by external ease factories diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll index b8fe712..3037201 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 efece54..40559de 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 3217915..06537fd 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 ec7728f..e68b315 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 897d920..b22aab6 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 fcd8bac..60b6ff0 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/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML index bd3c14c..1567aac 100644 --- a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML @@ -1759,6 +1759,32 @@ Path plugin works exclusively with Transforms + + + Allows to wrap ease method in special ways, adding extra features + + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Ease type + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + AnimationCurve to use for the ease + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Custom ease function to use + Types of loop @@ -1862,6 +1888,7 @@ Used to interpret AnimationCurves as eases. + Public so it can be used by external ease factories diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll index b8fe712..3037201 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 efece54..40559de 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 3217915..06537fd 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 ec7728f..e68b315 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 897d920..b22aab6 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 fcd8bac..60b6ff0 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.Unity5/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML index bd3c14c..1567aac 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML @@ -1759,6 +1759,32 @@ Path plugin works exclusively with Transforms + + + Allows to wrap ease method in special ways, adding extra features + + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Ease type + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + AnimationCurve to use for the ease + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Custom ease function to use + Types of loop @@ -1862,6 +1888,7 @@ Used to interpret AnimationCurves as eases. + Public so it can be used by external ease factories diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index b8fe712..3037201 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 efece54..40559de 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 3217915..06537fd 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 ec7728f..e68b315 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 897d920..b22aab6 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 fcd8bac..60b6ff0 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/_Tests PRO/PoolingTweens.cs b/UnityTests.Unity5/Assets/_Tests PRO/PoolingTweens.cs index 6e04565..3ebc56f 100644 --- a/UnityTests.Unity5/Assets/_Tests PRO/PoolingTweens.cs +++ b/UnityTests.Unity5/Assets/_Tests PRO/PoolingTweens.cs @@ -5,7 +5,13 @@ using System.Collections; public class PoolingTweens : BrainBase { - public GameObject prefab; + public Transform container; + public bool spawnInContainer; + + void Start() + { + container.DOMoveX(30, 40); + } void Update() { @@ -16,20 +22,20 @@ public class PoolingTweens : BrainBase if (Input.GetKey(KeyCode.LeftShift)) { // Spawn path if (Input.GetKey(KeyCode.Space)) { - Transform t = HOPoolManager.Spawn(TestPOP.DOPathCubeasChild, wPos); - t.GetComponentInChildren().DORestart(true); + HOPoolManager.Spawn(TestPOP.DOPathCubeasChild, wPos, spawnInContainer ? container : null); + // t.GetComponentInChildren().DORestart(true); } else { - Transform t = HOPoolManager.Spawn(TestPOP.DOPathCube, wPos); - t.GetComponent().DORestart(true); + HOPoolManager.Spawn(TestPOP.DOPathCube, wPos, spawnInContainer ? container : null); + // t.GetComponent().DORestart(true); } } else { // Spawn dice if (Input.GetKey(KeyCode.Space)) { - Transform t = HOPoolManager.Spawn(TestPOP.DOAnimationDiceasChild, wPos); - t.GetComponentInChildren().DORestart(true); + HOPoolManager.Spawn(TestPOP.DOAnimationDiceasChild, wPos, spawnInContainer ? container : null); + // t.GetComponentInChildren().DORestart(true); } else { - Transform t = HOPoolManager.Spawn(TestPOP.DOAnimationDice, wPos); - t.GetComponent().DORestart(true); + HOPoolManager.Spawn(TestPOP.DOAnimationDice, wPos, spawnInContainer ? container : null); + // t.GetComponent().DORestart(true); } } } diff --git a/UnityTests.Unity5/Assets/_Tests PRO/PoolingTweens.unity b/UnityTests.Unity5/Assets/_Tests PRO/PoolingTweens.unity index 9294a59..0a2338e 100644 Binary files a/UnityTests.Unity5/Assets/_Tests PRO/PoolingTweens.unity and b/UnityTests.Unity5/Assets/_Tests PRO/PoolingTweens.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.cs b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.cs new file mode 100644 index 0000000..545c548 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections; +using DG.Tweening; +using DG.Tweening.Core.Easing; + +// Test class for EaseFactory feature created by Andrei Stanescu - https://github.com/reydanro +public class EaseFactoryTests : BrainBase +{ + public enum EaseType + { + Default, + Ease, + AnimationCurve + } + + public int stopMotionFPS = 5; + public EaseType easeType; + public Ease ease = Ease.Linear; + public AnimationCurve easeCurve; + public Transform target; + + void Start() + { + Tween t = target.DOMove(new Vector3(0,4,0), 2); + // Tween t = target.DORotate(new Vector3(0,180,0), 2); + if (easeType == EaseType.AnimationCurve) t.SetEase(EaseFactory.StopMotion(stopMotionFPS, easeCurve)); + else if (easeType == EaseType.Ease) t.SetEase(EaseFactory.StopMotion(stopMotionFPS, ease)); + else t.SetEase(EaseFactory.StopMotion(stopMotionFPS)); + t.SetAutoKill(false).SetLoops(3, LoopType.Yoyo).Pause(); + } + + void OnGUI() + { + if (GUILayout.Button("TogglePause")) DOTween.TogglePauseAll(); + if (GUILayout.Button("Restart")) DOTween.RestartAll(); + if (GUILayout.Button("Complete")) DOTween.CompleteAll(); + if (GUILayout.Button("Rewind")) DOTween.RewindAll(); + if (GUILayout.Button("Flip")) DOTween.FlipAll(); + if (GUILayout.Button("Kill And Complete")) DOTween.KillAll(true); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.cs.meta b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.cs.meta new file mode 100644 index 0000000..4090536 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8c9c25baad86b36448a7d4fc92de55d9 +timeCreated: 1428149285 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.unity b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.unity new file mode 100644 index 0000000..e2a446c Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.unity.meta b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.unity.meta new file mode 100644 index 0000000..765c1e0 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/EaseFactoryTests.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed4ff95cc82ecb248b3c26a48b6dac52 +timeCreated: 1428149274 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice as Child.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice as Child.prefab index 36360ab..0a34327 100644 Binary files a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice as Child.prefab and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice as Child.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice.prefab index a088c5b..1d876bc 100644 Binary files a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice.prefab and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOAnimation Dice.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube as Child.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube as Child.prefab index 3df6e92..86bc3dc 100644 Binary files a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube as Child.prefab and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube as Child.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube.prefab b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube.prefab index 94d8bdd..10bdcc3 100644 Binary files a/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube.prefab and b/UnityTests.Unity5/Assets/_Tests/_Shared Prefabs/DOPath Cube.prefab differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledAnimation.cs b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledAnimation.cs new file mode 100644 index 0000000..346a583 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledAnimation.cs @@ -0,0 +1,21 @@ +using UnityEngine; +using DG.Tweening; + +public class PooledAnimation : MonoBehaviour +{ + public void OnSpawn() + { + DOTweenAnimation doanim = this.GetComponent(); + if (doanim) doanim.DORestart(true); + DOTweenPath dopath = this.GetComponent(); + if (dopath) dopath.DORestart(true); + } + + public void OnDespawn() + { + DOTweenAnimation doanim = this.GetComponent(); + if (doanim) doanim.DORewind(); + DOTweenPath dopath = this.GetComponent(); + if (dopath) dopath.DORewind(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledAnimation.cs.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledAnimation.cs.meta new file mode 100644 index 0000000..03a96d3 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledAnimation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 816ee70192fc92f488253bb355e65ef1 +timeCreated: 1428163637 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledChildAnimation.cs b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledChildAnimation.cs new file mode 100644 index 0000000..5b83f2c --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledChildAnimation.cs @@ -0,0 +1,21 @@ +using UnityEngine; +using DG.Tweening; + +public class PooledChildAnimation : MonoBehaviour +{ + public void OnSpawn() + { + DOTweenAnimation doanim = this.GetComponentInChildren(); + if (doanim) doanim.DORestart(true); + DOTweenPath dopath = this.GetComponentInChildren(); + if (dopath) dopath.DORestart(true); + } + + public void OnDespawn() + { + DOTweenAnimation doanim = this.GetComponentInChildren(); + if (doanim) doanim.DORewind(); + DOTweenPath dopath = this.GetComponentInChildren(); + if (dopath) dopath.DORewind(); + } +} \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledChildAnimation.cs.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledChildAnimation.cs.meta new file mode 100644 index 0000000..cecc0d5 --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Scripts/PooledChildAnimation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dde3517e948b0a143832c31dcfe25706 +timeCreated: 1428163655 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/_DOTween.Assembly/DOTween/Core/Easing/EaseCurve.cs b/_DOTween.Assembly/DOTween/Core/Easing/EaseCurve.cs index 0d773f9..41a714e 100644 --- a/_DOTween.Assembly/DOTween/Core/Easing/EaseCurve.cs +++ b/_DOTween.Assembly/DOTween/Core/Easing/EaseCurve.cs @@ -10,8 +10,9 @@ namespace DG.Tweening.Core.Easing { /// /// Used to interpret AnimationCurves as eases. + /// Public so it can be used by external ease factories /// - internal class EaseCurve + public class EaseCurve { readonly AnimationCurve _animCurve; diff --git a/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs index 93e763f..e6ce439 100644 --- a/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs +++ b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs @@ -167,5 +167,153 @@ namespace DG.Tweening.Core.Easing return -(time /= duration) * (time - 2); } } + + public static EaseFunction ToEaseFunction(Ease ease) + { + switch (ease) { + case Ease.Linear: + return (float time, float duration, float overshootOrAmplitude, float period) => + time / duration; + case Ease.InSine: + return (float time, float duration, float overshootOrAmplitude, float period) => + -(float)Math.Cos(time / duration * _PiOver2) + 1; + case Ease.OutSine: + return (float time, float duration, float overshootOrAmplitude, float period) => + (float)Math.Sin(time / duration * _PiOver2); + case Ease.InOutSine: + return (float time, float duration, float overshootOrAmplitude, float period) => + -0.5f * ((float)Math.Cos(Mathf.PI * time / duration) - 1); + case Ease.InQuad: + return (float time, float duration, float overshootOrAmplitude, float period) => + (time /= duration) * time; + case Ease.OutQuad: + return (float time, float duration, float overshootOrAmplitude, float period) => + -(time /= duration) * (time - 2); + case Ease.InOutQuad: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time; + return -0.5f * ((--time) * (time - 2) - 1); + }; + case Ease.InCubic: + return (float time, float duration, float overshootOrAmplitude, float period) => + (time /= duration) * time * time; + case Ease.OutCubic: + return (float time, float duration, float overshootOrAmplitude, float period) => + ((time = time / duration - 1) * time * time + 1); + case Ease.InOutCubic: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time * time; + return 0.5f * ((time -= 2) * time * time + 2); + }; + case Ease.InQuart: + return (float time, float duration, float overshootOrAmplitude, float period) => + (time /= duration) * time * time * time; + case Ease.OutQuart: + return (float time, float duration, float overshootOrAmplitude, float period) => + -((time = time / duration - 1) * time * time * time - 1); + case Ease.InOutQuart: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time * time * time; + return -0.5f * ((time -= 2) * time * time * time - 2); + }; + case Ease.InQuint: + return (float time, float duration, float overshootOrAmplitude, float period) => + (time /= duration) * time * time * time * time; + case Ease.OutQuint: + return (float time, float duration, float overshootOrAmplitude, float period) => + ((time = time / duration - 1) * time * time * time * time + 1); + case Ease.InOutQuint: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if ((time /= duration * 0.5f) < 1) return 0.5f * time * time * time * time * time; + return 0.5f * ((time -= 2) * time * time * time * time + 2); + }; + case Ease.InExpo: + return (float time, float duration, float overshootOrAmplitude, float period) => + (time == 0) ? 0 : (float)Math.Pow(2, 10 * (time / duration - 1)); + case Ease.OutExpo: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if (time == duration) return 1; + return (-(float)Math.Pow(2, -10 * time / duration) + 1); + }; + case Ease.InOutExpo: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if (time == 0) return 0; + if (time == duration) return 1; + if ((time /= duration * 0.5f) < 1) return 0.5f * (float)Math.Pow(2, 10 * (time - 1)); + return 0.5f * (-(float)Math.Pow(2, -10 * --time) + 2); + }; + case Ease.InCirc: + return (float time, float duration, float overshootOrAmplitude, float period) => + -((float)Math.Sqrt(1 - (time /= duration) * time) - 1); + case Ease.OutCirc: + return (float time, float duration, float overshootOrAmplitude, float period) => + (float)Math.Sqrt(1 - (time = time / duration - 1) * time); + case Ease.InOutCirc: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if ((time /= duration * 0.5f) < 1) return -0.5f * ((float)Math.Sqrt(1 - time * time) - 1); + return 0.5f * ((float)Math.Sqrt(1 - (time -= 2) * time) + 1); + }; + case Ease.InElastic: + return (float time, float duration, float overshootOrAmplitude, float period) => { + float s0; + if (time == 0) return 0; + if ((time /= duration) == 1) return 1; + if (period == 0) period = duration * 0.3f; + if (overshootOrAmplitude < 1) { + overshootOrAmplitude = 1; + s0 = period / 4; + } else s0 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude); + return -(overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s0) * _TwoPi / period)); + }; + case Ease.OutElastic: + return (float time, float duration, float overshootOrAmplitude, float period) => { + float s1; + if (time == 0) return 0; + if ((time /= duration) == 1) return 1; + if (period == 0) period = duration * 0.3f; + if (overshootOrAmplitude < 1) { + overshootOrAmplitude = 1; + s1 = period / 4; + } else s1 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude); + return (overshootOrAmplitude * (float)Math.Pow(2, -10 * time) * (float)Math.Sin((time * duration - s1) * _TwoPi / period) + 1); + }; + case Ease.InOutElastic: + return (float time, float duration, float overshootOrAmplitude, float period) => { + float s; + if (time == 0) return 0; + if ((time /= duration * 0.5f) == 2) return 1; + if (period == 0) period = duration * (0.3f * 1.5f); + if (overshootOrAmplitude < 1) { + overshootOrAmplitude = 1; + s = period / 4; + } else s = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude); + if (time < 1) return -0.5f * (overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period)); + return overshootOrAmplitude * (float)Math.Pow(2, -10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period) * 0.5f + 1; + }; + case Ease.InBack: + return (float time, float duration, float overshootOrAmplitude, float period) => + (time /= duration) * time * ((overshootOrAmplitude + 1) * time - overshootOrAmplitude); + case Ease.OutBack: + return (float time, float duration, float overshootOrAmplitude, float period) => + ((time = time / duration - 1) * time * ((overshootOrAmplitude + 1) * time + overshootOrAmplitude) + 1); + case Ease.InOutBack: + return (float time, float duration, float overshootOrAmplitude, float period) => { + if ((time /= duration * 0.5f) < 1) return 0.5f * (time * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time - overshootOrAmplitude)); + return 0.5f * ((time -= 2) * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time + overshootOrAmplitude) + 2); + }; + case Ease.InBounce: + return (float time, float duration, float overshootOrAmplitude, float period) => + Bounce.EaseIn(time, duration, overshootOrAmplitude, period); + case Ease.OutBounce: + return (float time, float duration, float overshootOrAmplitude, float period) => + Bounce.EaseOut(time, duration, overshootOrAmplitude, period); + case Ease.InOutBounce: + return (float time, float duration, float overshootOrAmplitude, float period) => + Bounce.EaseInOut(time, duration, overshootOrAmplitude, period); + default: + // OutQuad + return (float time, float duration, float overshootOrAmplitude, float period) => -(time /= duration) * (time - 2); + } + } } } \ No newline at end of file diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index c29d822..f71919d 100644 --- a/_DOTween.Assembly/DOTween/DOTween.cs +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -21,7 +21,7 @@ namespace DG.Tweening public class DOTween { /// DOTween's version - public static readonly string Version = "1.0.426"; + public static readonly string Version = "1.0.430"; /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTween/DOTween.csproj b/_DOTween.Assembly/DOTween/DOTween.csproj index b37bd6d..fcabb06 100644 --- a/_DOTween.Assembly/DOTween/DOTween.csproj +++ b/_DOTween.Assembly/DOTween/DOTween.csproj @@ -76,6 +76,7 @@ + diff --git a/_DOTween.Assembly/DOTween/EaseFactory.cs b/_DOTween.Assembly/DOTween/EaseFactory.cs new file mode 100644 index 0000000..cb1dc35 --- /dev/null +++ b/_DOTween.Assembly/DOTween/EaseFactory.cs @@ -0,0 +1,57 @@ +// Author: Andrei Stanescu - https://github.com/reydanro +// Unity Forum Post: http://forum.unity3d.com/threads/dotween-hotween-v2-a-unity-tween-engine.260692/page-24#post-2052957 +// Created: 2015/04/04 14:39 +// Modified by: Daniele Giardini - http://www.demigiant.com + +using DG.Tweening.Core.Easing; +using UnityEngine; + +namespace DG.Tweening +{ + /// + /// Allows to wrap ease method in special ways, adding extra features + /// + public class EaseFactory + { + #region StopMotion + + /// + /// Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + /// + /// FPS at which the tween should be played + /// Ease type + public static EaseFunction StopMotion(int motionFps, Ease? ease = null) + { + EaseFunction easeFunc = EaseManager.ToEaseFunction(ease == null ? DOTween.defaultEaseType : (Ease)ease); + return StopMotion(motionFps, easeFunc); + } + /// + /// Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + /// + /// FPS at which the tween should be played + /// AnimationCurve to use for the ease + public static EaseFunction StopMotion(int motionFps, AnimationCurve animCurve) + { + return StopMotion(motionFps, new EaseCurve(animCurve).Evaluate); + } + /// + /// Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + /// + /// FPS at which the tween should be played + /// Custom ease function to use + public static EaseFunction StopMotion(int motionFps, EaseFunction customEase) + { + // Compute the time interval in which we must re-evaluate the value + float motionDelay = 1.0f / motionFps; + + return delegate(float time, float duration, float overshootOrAmplitude, float period) { + // Adjust the time so it's in steps + float steptime = time < duration ? time - (time % motionDelay) : time; + // Evaluate the ease value based on the new step time + return customEase(steptime, duration, overshootOrAmplitude, period); + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/_DOTween.Assembly/bin/DOTween.XML b/_DOTween.Assembly/bin/DOTween.XML index bd3c14c..1567aac 100644 --- a/_DOTween.Assembly/bin/DOTween.XML +++ b/_DOTween.Assembly/bin/DOTween.XML @@ -1759,6 +1759,32 @@ Path plugin works exclusively with Transforms + + + Allows to wrap ease method in special ways, adding extra features + + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Ease type + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + AnimationCurve to use for the ease + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Custom ease function to use + Types of loop @@ -1862,6 +1888,7 @@ Used to interpret AnimationCurves as eases. + Public so it can be used by external ease factories diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index b8fe712..3037201 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 efece54..40559de 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 3217915..06537fd 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 ec7728f..e68b315 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 897d920..b22aab6 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 fcd8bac..60b6ff0 100644 Binary files a/_DOTween.Assembly/bin/DOTween46.dll.mdb and b/_DOTween.Assembly/bin/DOTween46.dll.mdb differ