1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-06 07:14:57 +08:00

Merge branch 'feature/Win81Fix' into develop

This commit is contained in:
Daniele Giardini 2015-04-16 21:45:21 +02:00
commit 9de263193a
105 changed files with 2116 additions and 201 deletions

3
.gitignore vendored
View File

@ -21,4 +21,5 @@ ExternalPluginsTestsAndExamples*
*.Unity*/Assets/-tk2d*
*.Unity*/Assets/Console*Pro*
*.Unity*/Assets/Text*Mesh*Pro*
*HOPoolOperator*
*HOPoolOperator*
zz builds

View File

@ -1183,6 +1183,45 @@
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Light,UnityEngine.Color,System.Single)">
<summary>Tweens a Light's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Light as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.Single)">
<summary>Tweens a Material's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.String,System.Single)">
<summary>Tweens a Material's named color property to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.Single)">
<summary>Tweens a Material's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.String,System.Single)">
<summary>Tweens a Material's named alpha property BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableMoveBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Boolean)">
<summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableMove tweens to work together on the same target,

View File

@ -43,5 +43,19 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
<summary>Tweens a SpriteRenderer's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.SpriteRenderer,System.Single,System.Single)">
<summary>Tweens a SpriteRenderer's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
</members>
</doc>

View File

@ -118,5 +118,47 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Graphic,UnityEngine.Color,System.Single)">
<summary>Tweens a Graphic's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Graphic,System.Single,System.Single)">
<summary>Tweens a Graphic's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Image,UnityEngine.Color,System.Single)">
<summary>Tweens a Image's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Image as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Image,System.Single,System.Single)">
<summary>Tweens a Image's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Image as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Text,UnityEngine.Color,System.Single)">
<summary>Tweens a Text's color BY the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Text as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Text,System.Single,System.Single)">
<summary>Tweens a Text's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Text as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
</members>
</doc>

View File

@ -1183,6 +1183,45 @@
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Light,UnityEngine.Color,System.Single)">
<summary>Tweens a Light's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Light as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.Single)">
<summary>Tweens a Material's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.String,System.Single)">
<summary>Tweens a Material's named color property to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.Single)">
<summary>Tweens a Material's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.String,System.Single)">
<summary>Tweens a Material's named alpha property BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableMoveBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Boolean)">
<summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableMove tweens to work together on the same target,

View File

@ -43,5 +43,19 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
<summary>Tweens a SpriteRenderer's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.SpriteRenderer,System.Single,System.Single)">
<summary>Tweens a SpriteRenderer's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
</members>
</doc>

View File

@ -118,5 +118,47 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Graphic,UnityEngine.Color,System.Single)">
<summary>Tweens a Graphic's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Graphic,System.Single,System.Single)">
<summary>Tweens a Graphic's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Image,UnityEngine.Color,System.Single)">
<summary>Tweens a Image's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Image as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Image,System.Single,System.Single)">
<summary>Tweens a Image's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Image as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Text,UnityEngine.Color,System.Single)">
<summary>Tweens a Text's color BY the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Text as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Text,System.Single,System.Single)">
<summary>Tweens a Text's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Text as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
</members>
</doc>

View File

@ -1183,6 +1183,45 @@
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Light,UnityEngine.Color,System.Single)">
<summary>Tweens a Light's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Light as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.Single)">
<summary>Tweens a Material's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.String,System.Single)">
<summary>Tweens a Material's named color property to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.Single)">
<summary>Tweens a Material's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.String,System.Single)">
<summary>Tweens a Material's named alpha property BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableMoveBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Boolean)">
<summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableMove tweens to work together on the same target,

View File

@ -43,5 +43,19 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
<summary>Tweens a SpriteRenderer's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.SpriteRenderer,System.Single,System.Single)">
<summary>Tweens a SpriteRenderer's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
</members>
</doc>

View File

@ -118,5 +118,47 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Graphic,UnityEngine.Color,System.Single)">
<summary>Tweens a Graphic's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Graphic,System.Single,System.Single)">
<summary>Tweens a Graphic's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Image,UnityEngine.Color,System.Single)">
<summary>Tweens a Image's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Image as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Image,System.Single,System.Single)">
<summary>Tweens a Image's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Image as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.UI.Text,UnityEngine.Color,System.Single)">
<summary>Tweens a Text's color BY the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Text as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.UI.Text,System.Single,System.Single)">
<summary>Tweens a Text's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Text as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
</members>
</doc>

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 42c12149efdc035458bffa42058b9a04
timeCreated: 1426681070
licenseType: Pro
timeCreated: 1429055804
licenseType: Free
PluginImporter:
serializedVersion: 1
iconMap: {}

View File

@ -10,8 +10,11 @@ public class BlendableTweens : BrainBase
public bool repeatBlendable = true;
public RotateMode rotationMode;
public Ease ease = Ease.OutQuad;
public Transform[] targets;
public Color toBlendableColor0, toBlendableColor1;
public Transform nonBlendableT;
public Transform[] targets;
public Renderer[] renderers;
public SpriteRenderer[] sprites;
Vector3[] startPositions;
@ -23,6 +26,8 @@ public class BlendableTweens : BrainBase
yield return new WaitForSeconds(0.6f);
Vector3 to;
Color toCol;
float toFloat;
float duration;
int loops;
@ -70,6 +75,56 @@ public class BlendableTweens : BrainBase
to = new Vector3(0, 90, 0);
if (from) nonBlendableT.DORotate(to, duration, rotationMode).From(true).SetEase(ease).SetAutoKill(false).Pause();
else nonBlendableT.DORotate(to, duration, rotationMode).SetEase(ease).SetAutoKill(false).Pause();
// Color
duration = 3;
toCol = toBlendableColor0;
if (from) renderers[0].material.DOBlendableColor(toCol, duration).From().SetEase(ease).SetAutoKill(false).Pause();
else renderers[0].material.DOBlendableColor(toCol, duration).SetEase(ease).SetAutoKill(false).Pause();
if (addBlendable) {
toCol = toBlendableColor1;
duration = repeatBlendable ? 1 : 3;
loops = repeatBlendable ? 3 : 1;
if (fromBlendable) renderers[0].material.DOBlendableColor(toCol, duration).From().SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
else renderers[0].material.DOBlendableColor(toCol, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
}
duration = 3;
toCol = toBlendableColor0;
if (from) sprites[0].DOBlendableColor(toCol, duration).From().SetEase(ease).SetAutoKill(false).Pause();
else sprites[0].DOBlendableColor(toCol, duration).SetEase(ease).SetAutoKill(false).Pause();
if (addBlendable) {
toCol = toBlendableColor1;
duration = repeatBlendable ? 1 : 3;
loops = repeatBlendable ? 3 : 1;
if (fromBlendable) sprites[0].DOBlendableColor(toCol, duration).From().SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
else sprites[0].DOBlendableColor(toCol, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
}
// Fade
duration = 3;
toFloat = -1;
if (from) renderers[1].material.DOBlendableFadeBy(toFloat, duration).From().SetEase(ease).SetAutoKill(false).Pause();
else renderers[1].material.DOBlendableFadeBy(toFloat, duration).SetEase(ease).SetAutoKill(false).Pause();
if (addBlendable) {
toFloat = 1;
duration = repeatBlendable ? 1 : 3;
loops = repeatBlendable ? 3 : 1;
if (fromBlendable) renderers[1].material.DOBlendableFadeBy(toFloat, duration).From().SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
else renderers[1].material.DOBlendableFadeBy(toFloat, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
}
duration = 3;
toFloat = -1;
if (from) sprites[1].DOBlendableFadeBy(toFloat, duration).From().SetEase(ease).SetAutoKill(false).Pause();
else sprites[1].DOBlendableFadeBy(toFloat, duration).SetEase(ease).SetAutoKill(false).Pause();
if (addBlendable) {
toFloat = 1;
duration = repeatBlendable ? 1 : 3;
loops = repeatBlendable ? 3 : 1;
if (fromBlendable) sprites[1].DOBlendableFadeBy(toFloat, duration).From().SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
else sprites[1].DOBlendableFadeBy(toFloat, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause();
}
}
void OnGUI()

View File

@ -5,18 +5,11 @@ using System.Collections;
public class Temp : BrainBase
{
public Transform target;
public RectTransform t;
IEnumerator Start()
{
target.DOMoveX(2, 3).OnComplete(()=> {
Debug.Log("call");
target.GetComponent<TempMonoBehaviour>().Goco();
Debug.Log("after call");
});
yield return new WaitForSeconds(1);
target.gameObject.SetActive(false);
yield return new WaitForSeconds(0.6f);
DOTween.To(() => t.anchorMin, (x) => t.anchorMin = x, new Vector2(-1,0) , 2.0f).OnComplete(()=>Debug.Log(t.anchorMin.ToString("N16")));
}
}

View File

@ -7,13 +7,8 @@ using System;
public class TempTests : BrainBase
{
void OnEnable()
void OnMouseDown()
{
Debug.Log("ENABLE");
}
void OnDisable()
{
Debug.Log("DISABLE");
this.GetComponent<DOTweenAnimation>().DOPlay();
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9c25459fcc7c05a45ae2bac021a83e01
timeCreated: 1429119523
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,2 +1,2 @@
m_EditorVersion: 5.0.0f4
m_EditorVersion: 5.0.1f1
m_StandardAssetsVersion: 0

View File

@ -532,29 +532,29 @@
<summary>Options for float tweens</summary>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{UnityEngine.Vector2,UnityEngine.Vector2,DG.Tweening.Plugins.Options.VectorOptions},System.Boolean)">
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{DG.Tweening.Core.Surrogates.Vector2Surrogate,DG.Tweening.Core.Surrogates.Vector2Surrogate,DG.Tweening.Plugins.Options.VectorOptions},System.Boolean)">
<summary>Options for Vector2 tweens</summary>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{UnityEngine.Vector2,UnityEngine.Vector2,DG.Tweening.Plugins.Options.VectorOptions},DG.Tweening.AxisConstraint,System.Boolean)">
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{DG.Tweening.Core.Surrogates.Vector2Surrogate,DG.Tweening.Core.Surrogates.Vector2Surrogate,DG.Tweening.Plugins.Options.VectorOptions},DG.Tweening.AxisConstraint,System.Boolean)">
<summary>Options for Vector2 tweens</summary>
<param name="axisConstraint">Selecting an axis will tween the vector only on that axis, leaving the others untouched</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{UnityEngine.Vector3,UnityEngine.Vector3,DG.Tweening.Plugins.Options.VectorOptions},System.Boolean)">
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{DG.Tweening.Core.Surrogates.Vector3Surrogate,DG.Tweening.Core.Surrogates.Vector3Surrogate,DG.Tweening.Plugins.Options.VectorOptions},System.Boolean)">
<summary>Options for Vector3 tweens</summary>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{UnityEngine.Vector3,UnityEngine.Vector3,DG.Tweening.Plugins.Options.VectorOptions},DG.Tweening.AxisConstraint,System.Boolean)">
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{DG.Tweening.Core.Surrogates.Vector3Surrogate,DG.Tweening.Core.Surrogates.Vector3Surrogate,DG.Tweening.Plugins.Options.VectorOptions},DG.Tweening.AxisConstraint,System.Boolean)">
<summary>Options for Vector3 tweens</summary>
<param name="axisConstraint">Selecting an axis will tween the vector only on that axis, leaving the others untouched</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{UnityEngine.Vector4,UnityEngine.Vector4,DG.Tweening.Plugins.Options.VectorOptions},System.Boolean)">
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{DG.Tweening.Core.Surrogates.Vector4Surrogate,DG.Tweening.Core.Surrogates.Vector4Surrogate,DG.Tweening.Plugins.Options.VectorOptions},System.Boolean)">
<summary>Options for Vector4 tweens</summary>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{UnityEngine.Vector4,UnityEngine.Vector4,DG.Tweening.Plugins.Options.VectorOptions},DG.Tweening.AxisConstraint,System.Boolean)">
<member name="M:DG.Tweening.TweenSettingsExtensions.SetOptions(DG.Tweening.Core.TweenerCore{DG.Tweening.Core.Surrogates.Vector4Surrogate,DG.Tweening.Core.Surrogates.Vector4Surrogate,DG.Tweening.Plugins.Options.VectorOptions},DG.Tweening.AxisConstraint,System.Boolean)">
<summary>Options for Vector4 tweens</summary>
<param name="axisConstraint">Selecting an axis will tween the vector only on that axis, leaving the others untouched</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
@ -918,6 +918,14 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOFade(UnityEngine.Material,System.Single,System.String,System.Single)">
<summary>Tweens a Material's alpha color to the given value
(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>
<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="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOFloat(UnityEngine.Material,System.Single,System.String,System.Single)">
<summary>Tweens a Material's named float property to the given value.
Also stores the material as the tween's target so it can be used for filtered operations</summary>
@ -1476,7 +1484,7 @@
<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>
</member>
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{UnityEngine.Vector2},DG.Tweening.Core.DOSetter{UnityEngine.Vector2},UnityEngine.Vector2,System.Single)">
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{DG.Tweening.Core.Surrogates.Vector2Surrogate},DG.Tweening.Core.DOSetter{DG.Tweening.Core.Surrogates.Vector2Surrogate},UnityEngine.Vector2,System.Single)">
<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.
<para>Example usage with lambda:</para><code>()=> myProperty</code></param>
@ -1484,7 +1492,7 @@
<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>
</member>
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{UnityEngine.Vector3},DG.Tweening.Core.DOSetter{UnityEngine.Vector3},UnityEngine.Vector3,System.Single)">
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{DG.Tweening.Core.Surrogates.Vector3Surrogate},DG.Tweening.Core.DOSetter{DG.Tweening.Core.Surrogates.Vector3Surrogate},UnityEngine.Vector3,System.Single)">
<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.
<para>Example usage with lambda:</para><code>()=> myProperty</code></param>
@ -1492,7 +1500,7 @@
<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>
</member>
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{UnityEngine.Vector4},DG.Tweening.Core.DOSetter{UnityEngine.Vector4},UnityEngine.Vector4,System.Single)">
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{DG.Tweening.Core.Surrogates.Vector4Surrogate},DG.Tweening.Core.DOSetter{DG.Tweening.Core.Surrogates.Vector4Surrogate},UnityEngine.Vector4,System.Single)">
<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.
<para>Example usage with lambda:</para><code>()=> myProperty</code></param>
@ -1543,7 +1551,7 @@
<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>
</member>
<member name="M:DG.Tweening.DOTween.ToAxis(DG.Tweening.Core.DOGetter{UnityEngine.Vector3},DG.Tweening.Core.DOSetter{UnityEngine.Vector3},System.Single,System.Single,DG.Tweening.AxisConstraint)">
<member name="M:DG.Tweening.DOTween.ToAxis(DG.Tweening.Core.DOGetter{DG.Tweening.Core.Surrogates.Vector3Surrogate},DG.Tweening.Core.DOSetter{DG.Tweening.Core.Surrogates.Vector3Surrogate},System.Single,System.Single,DG.Tweening.AxisConstraint)">
<summary>Tweens only one axis of a Vector3 to the given value using default plugins.</summary>
<param name="getter">A getter for the field or property to tween.
<para>Example usage with lambda:</para><code>()=> myProperty</code></param>
@ -2039,5 +2047,23 @@
Public only so custom shortcuts can access some of these methods
</summary>
</member>
<member name="T:DG.Tweening.Core.Surrogates.Vector4Surrogate">
<summary>
A surrogate for Vector2/3/4 values to work around Unity's bug when trying to cast to
a Vector2/3/4 plugin on WP8.1
</summary>
</member>
<member name="T:DG.Tweening.Core.Surrogates.Vector3Surrogate">
<summary>
A surrogate for Vector2/3/4 values to work around Unity's bug when trying to cast to
a Vector2/3/4 plugin on WP8.1
</summary>
</member>
<member name="T:DG.Tweening.Core.Surrogates.Vector2Surrogate">
<summary>
A surrogate for Vector2/3/4 values to work around Unity's bug when trying to cast to
a Vector2/3/4 plugin on WP8.1
</summary>
</member>
</members>
</doc>

View File

@ -22,7 +22,7 @@ public class TestScene : MonoBehaviour
SampleFloatClass sampleFloatClass;
SampleVector3Class sampleV3Class;
ISampleClass isampleClass;
Vector3Plugin dotweenV3Class;
// Vector3Plugin dotweenV3Class;
ITweenPlugin idotweenClass;
string testId;
@ -33,8 +33,8 @@ public class TestScene : MonoBehaviour
FloatTest();
log += "\n";
Vector3Test();
log += "\n";
DOTweenVector3Test();
// log += "\n";
// DOTweenVector3Test();
log += "\n\n<color=#00ff00>FIRST TEST ENDED</color>";
log += "\n\n<color=#00ff00>NOW WAITING 1 SECOND...</color>";
@ -53,72 +53,72 @@ public class TestScene : MonoBehaviour
// DOTween.To(()=>intToTween, x=> intToTween = x, 100, 4).OnUpdate(()=> text.text = intToTween.ToString());
}
void DOTweenVector3Test()
{
testId = "DOVector3 Class AsCast:";
try {
dotweenV3Class = new Vector3Plugin();
log += string.Format("{0}{1} " + ((dotweenV3Class as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
// void DOTweenVector3Test()
// {
// testId = "DOVector3 Class AsCast:";
// try {
// dotweenV3Class = new Vector3Plugin();
// log += string.Format("{0}{1} " + ((dotweenV3Class as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
testId = "DOVector3 Class AsCast (object):";
try {
dotweenV3Class = new Vector3Plugin();
log += string.Format("{0}{1} " + (((object)dotweenV3Class as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
// testId = "DOVector3 Class AsCast (object):";
// try {
// dotweenV3Class = new Vector3Plugin();
// log += string.Format("{0}{1} " + (((object)dotweenV3Class as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
testId = "DOVector3 Class PrefCast:";
try {
dotweenV3Class = new Vector3Plugin();
log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)dotweenV3Class == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
// testId = "DOVector3 Class PrefCast:";
// try {
// dotweenV3Class = new Vector3Plugin();
// log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)dotweenV3Class == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
testId = "DOVector3 Class PrefCast (object):";
try {
dotweenV3Class = new Vector3Plugin();
log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)((object)dotweenV3Class) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
// testId = "DOVector3 Class PrefCast (object):";
// try {
// dotweenV3Class = new Vector3Plugin();
// log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)((object)dotweenV3Class) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
testId = "DOVector3 Interface AsCast:";
try {
idotweenClass = new Vector3Plugin();
log += string.Format("{0}{1} " + ((idotweenClass as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
// testId = "DOVector3 Interface AsCast:";
// try {
// idotweenClass = new Vector3Plugin();
// log += string.Format("{0}{1} " + ((idotweenClass as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
testId = "DOVector3 Interface AsCast (object):";
try {
idotweenClass = new Vector3Plugin();
log += string.Format("{0}{1} " + (((object)idotweenClass as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
// testId = "DOVector3 Interface AsCast (object):";
// try {
// idotweenClass = new Vector3Plugin();
// log += string.Format("{0}{1} " + (((object)idotweenClass as ABSTweenPlugin<Vector3,Vector3,VectorOptions>) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
testId = "DOVector3 Interface PrefCast:";
try {
idotweenClass = new Vector3Plugin();
log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)idotweenClass == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
// testId = "DOVector3 Interface PrefCast:";
// try {
// idotweenClass = new Vector3Plugin();
// log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)idotweenClass == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
testId = "DOVector3 Interface PrefCast (object):";
try {
idotweenClass = new Vector3Plugin();
log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)((object)idotweenClass) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
} catch (Exception e) {
log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
}
}
// testId = "DOVector3 Interface PrefCast (object):";
// try {
// idotweenClass = new Vector3Plugin();
// log += string.Format("{0}{1} " + ((ABSTweenPlugin<Vector3,Vector3,VectorOptions>)((object)idotweenClass) == null ? "{2}" : "{3}"), logPrefix, testId, failStr, successStr);
// } catch (Exception e) {
// log += string.Format("{0}{1} <color=#ff0000>error > " + e.Message + "</color>", logPrefix, testId);
// }
// }
void Vector3Test()
{

Binary file not shown.

View File

@ -0,0 +1,66 @@
using UnityEngine;
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/15 12:10
#pragma warning disable 1591
namespace DG.Tweening.Core.Surrogates
{
public struct ColorSurrogate
{
public float r, g, b, a;
public ColorSurrogate(float r, float g, float b, float a)
{
this.r = r;
this.g = g;
this.b = b;
this.a = a;
}
#region Operations
public static ColorSurrogate operator +(ColorSurrogate v1, ColorSurrogate v2)
{
return new ColorSurrogate(v1.r + v2.r, v1.g + v2.g, v1.b + v2.b, v1.a + v2.a);
}
public static ColorSurrogate operator -(ColorSurrogate v1, ColorSurrogate v2)
{
return new ColorSurrogate(v1.r - v2.r, v1.g - v2.g, v1.b - v2.b, v1.a - v2.a);
}
public static ColorSurrogate operator *(ColorSurrogate v1, float f)
{
return new ColorSurrogate(v1.r * f, v1.g * f, v1.b * f, v1.a * f);
}
#endregion
#region Conversions
public static implicit operator Color(ColorSurrogate v)
{
return new Color(v.r, v.g, v.b, v.a);
}
public static implicit operator ColorSurrogate(Color v)
{
return new ColorSurrogate(v.r, v.g, v.b, v.a);
}
public static implicit operator Color32(ColorSurrogate v)
{
return new Color32((byte)(Mathf.Clamp01(v.r) * 255f), (byte)(Mathf.Clamp01(v.g) * 255f), (byte)(Mathf.Clamp01(v.b) * 255f), (byte)(Mathf.Clamp01(v.a) * 255f));
}
public static implicit operator ColorSurrogate(Color32 v)
{
return new ColorSurrogate((float)v.r / 255f, (float)v.g / 255f, (float)v.b / 255f, (float)v.a / 255f);
}
#endregion
}
}
#endif

View File

@ -0,0 +1,67 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/15 18:44
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Core.Surrogates
{
public struct QuaternionSurrogate
{
public float x, y, z, w;
public QuaternionSurrogate(float x, float y, float z, float w)
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
#region Operations
public static QuaternionSurrogate operator *(QuaternionSurrogate lhs, QuaternionSurrogate rhs)
{
return new QuaternionSurrogate(lhs.w * rhs.x + lhs.x * rhs.w + lhs.y * rhs.z - lhs.z * rhs.y, lhs.w * rhs.y + lhs.y * rhs.w + lhs.z * rhs.x - lhs.x * rhs.z, lhs.w * rhs.z + lhs.z * rhs.w + lhs.x * rhs.y - lhs.y * rhs.x, lhs.w * rhs.w - lhs.x * rhs.x - lhs.y * rhs.y - lhs.z * rhs.z);
}
public static Vector3Surrogate operator *(QuaternionSurrogate rotation, Vector3Surrogate point)
{
float num = rotation.x * 2f;
float num2 = rotation.y * 2f;
float num3 = rotation.z * 2f;
float num4 = rotation.x * num;
float num5 = rotation.y * num2;
float num6 = rotation.z * num3;
float num7 = rotation.x * num2;
float num8 = rotation.x * num3;
float num9 = rotation.y * num3;
float num10 = rotation.w * num;
float num11 = rotation.w * num2;
float num12 = rotation.w * num3;
Vector3Surrogate result;
result.x = (1f - (num5 + num6)) * point.x + (num7 - num12) * point.y + (num8 + num11) * point.z;
result.y = (num7 + num12) * point.x + (1f - (num4 + num6)) * point.y + (num9 - num10) * point.z;
result.z = (num8 - num11) * point.x + (num9 + num10) * point.y + (1f - (num4 + num5)) * point.z;
return result;
}
#endregion
#region Conversions
public static implicit operator Quaternion(QuaternionSurrogate v)
{
return new Quaternion(v.x, v.y, v.z, v.w);
}
public static implicit operator QuaternionSurrogate(Quaternion v)
{
return new QuaternionSurrogate(v.x, v.y, v.z, v.w);
}
#endregion
}
}
#endif

View File

@ -0,0 +1,63 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/14 12:42
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Core.Surrogates
{
/// <summary>
/// A surrogate for Vector2/3/4 values to work around Unity's bug when trying to cast to
/// a Vector2/3/4 plugin on WP8.1
/// </summary>
public struct Vector2Surrogate
{
public float x, y;
public float magnitude {
get { return Mathf.Sqrt(x * x + y * y); }
}
public Vector2Surrogate(float x, float y)
: this()
{
this.x = x;
this.y = y;
}
#region Operations
public static Vector2Surrogate operator +(Vector2Surrogate v1, Vector2Surrogate v2)
{
return new Vector2Surrogate(v1.x + v2.x, v1.y + v2.y);
}
public static Vector2Surrogate operator -(Vector2Surrogate v1, Vector2Surrogate v2)
{
return new Vector2Surrogate(v1.x - v2.x, v1.y - v2.y);
}
public static Vector2Surrogate operator *(Vector2Surrogate v1, float f)
{
return new Vector2Surrogate(v1.x * f, v1.y * f);
}
#endregion
#region Conversions
public static implicit operator Vector2(Vector2Surrogate v)
{
return new Vector2(v.x, v.y);
}
public static implicit operator Vector2Surrogate(Vector2 v)
{
return new Vector2Surrogate(v.x, v.y);
}
#endregion
}
}
#endif

View File

@ -0,0 +1,72 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/14 12:37
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Core.Surrogates
{
/// <summary>
/// A surrogate for Vector2/3/4 values to work around Unity's bug when trying to cast to
/// a Vector2/3/4 plugin on WP8.1
/// </summary>
public struct Vector3Surrogate
{
public float x, y, z;
public static Vector3Surrogate zero {
get { return new Vector3Surrogate(0, 0, 0); }
}
public float magnitude {
get { return Mathf.Sqrt(x * x + y * y + z * z); }
}
public Vector3Surrogate(float x, float y, float z)
: this()
{
this.x = x;
this.y = y;
this.z = z;
}
#region Operations
public static Vector3Surrogate operator +(Vector3Surrogate v1, Vector3Surrogate v2)
{
return new Vector3Surrogate(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
}
public static Vector3Surrogate operator -(Vector3Surrogate v1, Vector3Surrogate v2)
{
return new Vector3Surrogate(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
}
public static Vector3Surrogate operator -(Vector3Surrogate v1)
{
return new Vector3Surrogate(-v1.x, -v1.y, -v1.z);
}
public static Vector3Surrogate operator *(Vector3Surrogate v1, float f)
{
return new Vector3Surrogate(v1.x * f, v1.y * f, v1.z * f);
}
#endregion
#region Conversions
public static implicit operator Vector3(Vector3Surrogate v)
{
return new Vector3(v.x, v.y, v.z);
}
public static implicit operator Vector3Surrogate(Vector3 v)
{
return new Vector3Surrogate(v.x, v.y, v.z);
}
#endregion
}
}
#endif

View File

@ -0,0 +1,113 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/14 12:10
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Core.Surrogates
{
/// <summary>
/// A surrogate for Vector2/3/4 values to work around Unity's bug when trying to cast to
/// a Vector2/3/4 plugin on WP8.1
/// </summary>
public struct Vector4Surrogate
{
public float x, y, z, w;
public float magnitude {
get { return Mathf.Sqrt(x * x + y * y + z * z + w * w); }
}
public Vector4Surrogate(float x, float y, float z, float w)
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
#region Operations
public static Vector4Surrogate operator +(Vector4Surrogate v1, Vector4Surrogate v2)
{
return new Vector4Surrogate(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z, v1.w + v2.w);
}
public static Vector4Surrogate operator -(Vector4Surrogate v1, Vector4Surrogate v2)
{
return new Vector4Surrogate(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z, v1.w - v2.w);
}
public static Vector4Surrogate operator *(Vector4Surrogate v1, float f)
{
return new Vector4Surrogate(v1.x * f, v1.y * f, v1.z * f, v1.w * f);
}
// public static Vector4Surrogate operator /(Vector4Surrogate v1, float f)
// {
// return new Vector4Surrogate(v1.x / f, v1.y / f, v1.z / f, v1.w / f);
// }
#endregion
#region Comparisons
// public static bool operator <(Vector4Surrogate v1, Vector4Surrogate v2)
// {
// return v1.magnitude < v2.magnitude;
// }
//
// public static bool operator <=(Vector4Surrogate v1, Vector4Surrogate v2)
// {
// return v1.magnitude <= v2.magnitude;
// }
//
// public static bool operator >(Vector4Surrogate v1, Vector4Surrogate v2)
// {
// return v1.magnitude > v2.magnitude;
// }
//
// public static bool operator >=(Vector4Surrogate v1, Vector4Surrogate v2)
// {
// return v1.magnitude >= v2.magnitude;
// }
//
// public static bool operator ==(Vector4Surrogate v1, Vector4Surrogate v2)
// {
// return v1.x == v2.x && v1.y == v2.y && v1.z == v2.z && v1.w == v2.w;
// }
//
// public static bool operator !=(Vector4Surrogate v1, Vector4Surrogate v2)
// {
// return !(v1 == v2);
// }
#endregion
#region Conversions
// public static implicit operator Vector2(Vector4Surrogate v)
// {
// return new Vector2(v.x, v.y);
// }
//
// public static implicit operator Vector3(Vector4Surrogate v)
// {
// return new Vector3(v.x, v.y, v.z);
// }
public static implicit operator Vector4(Vector4Surrogate v)
{
return new Vector4(v.x, v.y, v.z, v.w);
}
public static implicit operator Vector4Surrogate(Vector4 v)
{
return new Vector4Surrogate(v.x, v.y, v.z, v.w);
}
#endregion
}
}
#endif

View File

@ -22,7 +22,7 @@ namespace DG.Tweening.Core
/// <summary>
/// Returns the 2D angle between two vectors
/// </summary>
public static float Angle2D(Vector3 from, Vector3 to)
internal static float Angle2D(Vector3 from, Vector3 to)
{
Vector2 baseDir = Vector2.right;
to -= from;

View File

@ -4,6 +4,9 @@
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
#if WP81
using DG.Tweening.Core.Surrogates;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
@ -21,7 +24,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.490";
public static readonly string Version = "1.0.531";
///////////////////////////////////////////////
// Options ////////////////////////////////////
@ -304,40 +307,65 @@ namespace DG.Tweening
/// <param name="setter">A setter for the field or property to tween
/// <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>
#if WP81
public static TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> To(DOGetter<Vector2Surrogate> getter, DOSetter<Vector2Surrogate> setter, Vector2 endValue, float duration)
{ return ApplyTo<Vector2Surrogate, Vector2Surrogate, VectorOptions>(getter, setter, endValue, duration); }
#else
public static TweenerCore<Vector2, Vector2, VectorOptions> To(DOGetter<Vector2> getter, DOSetter<Vector2> setter, Vector2 endValue, float duration)
{ return ApplyTo<Vector2, Vector2, VectorOptions>(getter, setter, endValue, duration); }
#endif
/// <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.
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
/// <param name="setter">A setter for the field or property to tween
/// <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>
#if WP81
public static TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> To(DOGetter<Vector3Surrogate> getter, DOSetter<Vector3Surrogate> setter, Vector3 endValue, float duration)
{ return ApplyTo<Vector3Surrogate, Vector3Surrogate, VectorOptions>(getter, setter, endValue, duration); }
#else
public static TweenerCore<Vector3, Vector3, VectorOptions> To(DOGetter<Vector3> getter, DOSetter<Vector3> setter, Vector3 endValue, float duration)
{ return ApplyTo<Vector3, Vector3, VectorOptions>(getter, setter, endValue, duration); }
#endif
/// <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.
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
/// <param name="setter">A setter for the field or property to tween
/// <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>
#if WP81
public static TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> To(DOGetter<Vector4Surrogate> getter, DOSetter<Vector4Surrogate> setter, Vector4 endValue, float duration)
{ return ApplyTo<Vector4Surrogate, Vector4Surrogate, VectorOptions>(getter, setter, endValue, duration); }
#else
public static TweenerCore<Vector4, Vector4, VectorOptions> To(DOGetter<Vector4> getter, DOSetter<Vector4> setter, Vector4 endValue, float duration)
{ return ApplyTo<Vector4, Vector4, VectorOptions>(getter, setter, endValue, duration); }
#endif
/// <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.
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
/// <param name="setter">A setter for the field or property to tween
/// <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>
#if WP81
public static TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> To(DOGetter<QuaternionSurrogate> getter, DOSetter<QuaternionSurrogate> setter, Vector3 endValue, float duration)
{ return ApplyTo<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions>(getter, setter, endValue, duration); }
#else
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> To(DOGetter<Quaternion> getter, DOSetter<Quaternion> setter, Vector3 endValue, float duration)
{ return ApplyTo<Quaternion, Vector3, QuaternionOptions>(getter, setter, endValue, duration); }
#endif
/// <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.
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
/// <param name="setter">A setter for the field or property to tween
/// <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>
#if WP81
public static TweenerCore<ColorSurrogate, ColorSurrogate, ColorOptions> To(DOGetter<ColorSurrogate> getter, DOSetter<ColorSurrogate> setter, Color endValue, float duration)
{ return ApplyTo<ColorSurrogate, ColorSurrogate, ColorOptions>(getter, setter, endValue, duration); }
#else
public static TweenerCore<Color, Color, ColorOptions> To(DOGetter<Color> getter, DOSetter<Color> setter, Color endValue, float duration)
{ return ApplyTo<Color, Color, ColorOptions>(getter, setter, endValue, duration); }
#endif
/// <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.
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
@ -377,20 +405,34 @@ namespace DG.Tweening
/// <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="axisConstraint">The axis to tween</param>
#if WP81
public static TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> ToAxis(DOGetter<Vector3Surrogate> getter, DOSetter<Vector3Surrogate> setter, float endValue, float duration, AxisConstraint axisConstraint = AxisConstraint.X)
{
TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t = ApplyTo<Vector3Surrogate, Vector3Surrogate, VectorOptions>(getter, setter, new Vector3Surrogate(endValue, endValue, endValue), duration);
t.plugOptions.axisConstraint = axisConstraint;
return t;
}
#else
public static TweenerCore<Vector3, Vector3, VectorOptions> ToAxis(DOGetter<Vector3> getter, DOSetter<Vector3> setter, float endValue, float duration, AxisConstraint axisConstraint = AxisConstraint.X)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = ApplyTo<Vector3, Vector3, VectorOptions>(getter, setter, new Vector3(endValue, endValue, endValue), duration);
t.plugOptions.axisConstraint = axisConstraint;
return t;
}
#endif
/// <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.
/// <para>Example usage with lambda:</para><code>()=> myProperty</code></param>
/// <param name="setter">A setter for the field or property to tween
/// <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>
#if WP81
public static Tweener ToAlpha(DOGetter<ColorSurrogate> getter, DOSetter<ColorSurrogate> setter, float endValue, float duration)
{ return ApplyTo<ColorSurrogate, ColorSurrogate, ColorOptions>(getter, setter, new ColorSurrogate(0, 0, 0, endValue), duration).SetOptions(true); }
#else
public static Tweener ToAlpha(DOGetter<Color> getter, DOSetter<Color> setter, float endValue, float duration)
{ return ApplyTo<Color, Color, ColorOptions>(getter, setter, new Color(0, 0, 0, endValue), duration).SetOptions(true); }
#endif
#endregion

View File

@ -71,8 +71,13 @@
<Compile Include="Core\Enums\UpdateMode.cs" />
<Compile Include="Core\Extensions.cs" />
<Compile Include="Core\SequenceCallback.cs" />
<Compile Include="Core\Surrogates\ColorSurrogate.cs" />
<Compile Include="Core\Surrogates\QuaternionSurrogate.cs" />
<Compile Include="Core\Surrogates\Vector2Surrogate.cs" />
<Compile Include="Core\Surrogates\Vector3Surrogate.cs" />
<Compile Include="Core\TweenManager.cs" />
<Compile Include="Core\Utils.cs" />
<Compile Include="Core\Surrogates\Vector4Surrogate.cs" />
<Compile Include="DOTween.cs" />
<Compile Include="DOVirtual.cs" />
<Compile Include="Ease.cs" />
@ -81,12 +86,15 @@
<Compile Include="PathMode.cs" />
<Compile Include="PathType.cs" />
<Compile Include="Plugins\Color2Plugin.cs" />
<Compile Include="Plugins\ColorSurrogatePlugin.cs" />
<Compile Include="Plugins\Core\PathCore\ControlPoint.cs" />
<Compile Include="Plugins\LongPlugin.cs" />
<Compile Include="Plugins\Options\PathOptions.cs" />
<Compile Include="Plugins\Options\QuaternionOptions.cs" />
<Compile Include="Plugins\Options\Vector3ArrayOptions.cs" />
<Compile Include="Plugins\QuaternionSurrogatePlugin.cs" />
<Compile Include="Plugins\UlongPlugin.cs" />
<Compile Include="Plugins\Vector2SurrogatePlugin.cs" />
<Compile Include="Plugins\Vector3ArrayPlugin.cs" />
<Compile Include="Plugins\Core\ITPlugin.cs" />
<Compile Include="Plugins\Core\SpecialPluginsUtils.cs" />
@ -95,6 +103,8 @@
<Compile Include="Plugins\Core\PathCore\LinearDecoder.cs" />
<Compile Include="Plugins\Core\PathCore\Path.cs" />
<Compile Include="Plugins\PathPlugin.cs" />
<Compile Include="Plugins\Vector3SurrogatePlugin.cs" />
<Compile Include="Plugins\Vector4SurrogatePlugin.cs" />
<Compile Include="RotateMode.cs" />
<Compile Include="ScrambleMode.cs" />
<Compile Include="TweenExtensions.cs" />

View File

@ -1,4 +1,5 @@
// Author: Daniele Giardini - http://www.demigiant.com
#if !WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2014/07/10 14:33
//
// License Copyright (c) Daniele Giardini.
@ -72,4 +73,5 @@ namespace DG.Tweening.Plugins
setter(res);
}
}
}
}
#endif

View File

@ -0,0 +1,74 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/15 12:17
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options;
#pragma warning disable 1591
namespace DG.Tweening.Plugins
{
public class ColorSurrogatePlugin : ABSTweenPlugin<ColorSurrogate, ColorSurrogate, ColorOptions>
{
public override void Reset(TweenerCore<ColorSurrogate, ColorSurrogate, ColorOptions> t) { }
public override void SetFrom(TweenerCore<ColorSurrogate, ColorSurrogate, ColorOptions> t, bool isRelative)
{
ColorSurrogate prevEndVal = t.endValue;
t.endValue = t.getter();
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
ColorSurrogate to = t.endValue;
if (!t.plugOptions.alphaOnly) to = t.startValue;
else to.a = t.startValue.a;
t.setter(to);
}
public override ColorSurrogate ConvertToStartValue(TweenerCore<ColorSurrogate, ColorSurrogate, ColorOptions> t, ColorSurrogate value)
{
return value;
}
public override void SetRelativeEndValue(TweenerCore<ColorSurrogate, ColorSurrogate, ColorOptions> t)
{
t.endValue += t.startValue;
}
public override void SetChangeValue(TweenerCore<ColorSurrogate, ColorSurrogate, ColorOptions> t)
{
t.changeValue = t.endValue - t.startValue;
}
public override float GetSpeedBasedDuration(ColorOptions options, float unitsXSecond, ColorSurrogate changeValue)
{
return 1f / unitsXSecond;
}
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<ColorSurrogate> getter, DOSetter<ColorSurrogate> setter, float elapsed, ColorSurrogate startValue, ColorSurrogate changeValue, float duration, bool usingInversePosition)
{
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1)
* (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
}
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
if (!options.alphaOnly) {
startValue.r += changeValue.r * easeVal;
startValue.g += changeValue.g * easeVal;
startValue.b += changeValue.b * easeVal;
startValue.a += changeValue.a * easeVal;
setter(startValue);
return;
}
// Alpha only
ColorSurrogate res = getter();
res.a = startValue.a + changeValue.a * easeVal;
setter(res);
}
}
}
#endif

View File

@ -4,10 +4,12 @@
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
#if WP81
using DG.Tweening.Core.Surrogates;
#endif
using System;
using System.Collections.Generic;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
namespace DG.Tweening.Plugins.Core
@ -43,7 +45,15 @@ namespace DG.Tweening.Plugins.Core
Type t1 = typeof(T1);
Type t2 = typeof(T2);
ITweenPlugin plugin = null;
#if WP81
if (t1 == typeof(Vector3Surrogate) && t1 == t2) {
if (_vector3Plugin == null) _vector3Plugin = new Vector3SurrogatePlugin();
plugin = _vector3Plugin;
} else if (t1 == typeof(Vector3) && t2 == typeof(Vector3[])) {
if (_vector3ArrayPlugin == null) _vector3ArrayPlugin = new Vector3ArrayPlugin();
plugin = _vector3ArrayPlugin;
}
#else
if (t1 == typeof(Vector3)) {
if (t1 == t2) {
if (_vector3Plugin == null) _vector3Plugin = new Vector3Plugin();
@ -52,28 +62,67 @@ namespace DG.Tweening.Plugins.Core
if (_vector3ArrayPlugin == null) _vector3ArrayPlugin = new Vector3ArrayPlugin();
plugin = _vector3ArrayPlugin;
}
} else if (t1 == typeof(Quaternion)) {
}
#endif
#if WP81
else if (t1 == typeof(QuaternionSurrogate)) {
if (t2 == typeof(Quaternion)) Debugger.LogError("Quaternion tweens require a Vector3 endValue");
else {
if (_quaternionPlugin == null) _quaternionPlugin = new QuaternionSurrogatePlugin();
plugin = _quaternionPlugin;
}
}
#else
else if (t1 == typeof(Quaternion)) {
if (t2 == typeof(Quaternion)) Debugger.LogError("Quaternion tweens require a Vector3 endValue");
else {
if (_quaternionPlugin == null) _quaternionPlugin = new QuaternionPlugin();
plugin = _quaternionPlugin;
}
} else if (t1 == typeof(Vector2)) {
}
#endif
#if WP81
else if (t1 == typeof(Vector2Surrogate)) {
if (_vector2Plugin == null) _vector2Plugin = new Vector2SurrogatePlugin();
plugin = _vector2Plugin;
}
#else
else if (t1 == typeof(Vector2)) {
if (_vector2Plugin == null) _vector2Plugin = new Vector2Plugin();
plugin = _vector2Plugin;
} else if (t1 == typeof(float)) {
}
#endif
else if (t1 == typeof(float)) {
if (_floatPlugin == null) _floatPlugin = new FloatPlugin();
plugin = _floatPlugin;
} else if (t1 == typeof(Color)) {
}
#if WP81
else if (t1 == typeof(ColorSurrogate)) {
if (_colorPlugin == null) _colorPlugin = new ColorSurrogatePlugin();
plugin = _colorPlugin;
}
#else
else if (t1 == typeof(Color)) {
if (_colorPlugin == null) _colorPlugin = new ColorPlugin();
plugin = _colorPlugin;
} else if (t1 == typeof(int)) {
}
#endif
else if (t1 == typeof(int)) {
if (_intPlugin == null) _intPlugin = new IntPlugin();
plugin = _intPlugin;
} else if (t1 == typeof(Vector4)) {
}
#if WP81
else if (t1 == typeof(Vector4Surrogate)) {
if (_vector4Plugin == null) _vector4Plugin = new Vector4SurrogatePlugin();
plugin = _vector4Plugin;
}
#else
else if (t1 == typeof(Vector4)) {
if (_vector4Plugin == null) _vector4Plugin = new Vector4Plugin();
plugin = _vector4Plugin;
} else if (t1 == typeof(Rect)) {
}
#endif
else if (t1 == typeof(Rect)) {
if (_rectPlugin == null) _rectPlugin = new RectPlugin();
plugin = _rectPlugin;
} else if (t1 == typeof(RectOffset)) {
@ -99,61 +148,62 @@ namespace DG.Tweening.Plugins.Core
#if !WP81
if (plugin != null) return plugin as ABSTweenPlugin<T1, T2, TPlugOptions>;
#else
if (plugin != null) return plugin as ABSTweenPlugin<T1, T2, TPlugOptions>;
// WP8.1 fix tries
if (plugin != null) {
Debug.Log("PLUGIN FOUND, trying to assign it correctly...");
ABSTweenPlugin<T1, T2, TPlugOptions> p;
ABSTweenPlugin<Vector3, Vector3, VectorOptions> pExplicit;
// Explicit casting to Vector3Plugin
try {
pExplicit = (ABSTweenPlugin<Vector3, Vector3, VectorOptions>)plugin;
if (pExplicit != null) Debug.Log("- EXPLICIT CAST SUCCESS X");
p = pExplicit as ABSTweenPlugin<T1, T2, TPlugOptions>;
if (p != null) {
Debug.Log("- PLUGIN SUCCESS X");
return p;
}
} catch (Exception e) {
Debug.Log("- PLUGIN FAIL X > " + e.Message);
}
// More regular ways
try {
p = plugin as ABSTweenPlugin<T1, T2, TPlugOptions>;
if (p != null) {
Debug.Log("- PLUGIN SUCCESS A");
return p;
}
} catch (Exception e) {
Debug.Log("- PLUGIN FAIL A > " + e.Message);
}
try {
System.Object obj = (object)plugin;
p = obj as ABSTweenPlugin<T1, T2, TPlugOptions>;
if (p != null) {
Debug.Log("- PLUGIN SUCCESS A2");
return p;
}
} catch (Exception e) {
Debug.Log("- PLUGIN FAIL A2 > " + e.Message);
}
try {
p = (ABSTweenPlugin<T1, T2, TPlugOptions>)plugin;
Debug.Log("- PLUGIN SUCCESS B");
return p;
} catch (Exception e) {
Debug.Log("- PLUGIN FAIL B > " + e.Message);
}
try {
System.Object obj = (object)plugin;
p = (ABSTweenPlugin<T1, T2, TPlugOptions>)obj;
Debug.Log("- PLUGIN SUCCESS B2");
return p;
} catch (Exception e) {
Debug.Log("- PLUGIN FAIL B2 > " + e.Message);
}
return null;
}
Debug.Log("PLUGIN NOT FOUND");
// if (plugin != null) {
// Debug.Log("PLUGIN FOUND, trying to assign it correctly...");
// ABSTweenPlugin<T1, T2, TPlugOptions> p;
// ABSTweenPlugin<Vector3, Vector3, VectorOptions> pExplicit;
// // Explicit casting to Vector3Plugin
// try {
// pExplicit = (ABSTweenPlugin<Vector3, Vector3, VectorOptions>)plugin;
// if (pExplicit != null) Debug.Log("- EXPLICIT CAST SUCCESS X");
// p = pExplicit as ABSTweenPlugin<T1, T2, TPlugOptions>;
// if (p != null) {
// Debug.Log("- PLUGIN SUCCESS X");
// return p;
// }
// } catch (Exception e) {
// Debug.Log("- PLUGIN FAIL X > " + e.Message);
// }
// // More regular ways
// try {
// p = plugin as ABSTweenPlugin<T1, T2, TPlugOptions>;
// if (p != null) {
// Debug.Log("- PLUGIN SUCCESS A");
// return p;
// }
// } catch (Exception e) {
// Debug.Log("- PLUGIN FAIL A > " + e.Message);
// }
// try {
// System.Object obj = (object)plugin;
// p = obj as ABSTweenPlugin<T1, T2, TPlugOptions>;
// if (p != null) {
// Debug.Log("- PLUGIN SUCCESS A2");
// return p;
// }
// } catch (Exception e) {
// Debug.Log("- PLUGIN FAIL A2 > " + e.Message);
// }
// try {
// p = (ABSTweenPlugin<T1, T2, TPlugOptions>)plugin;
// Debug.Log("- PLUGIN SUCCESS B");
// return p;
// } catch (Exception e) {
// Debug.Log("- PLUGIN FAIL B > " + e.Message);
// }
// try {
// System.Object obj = (object)plugin;
// p = (ABSTweenPlugin<T1, T2, TPlugOptions>)obj;
// Debug.Log("- PLUGIN SUCCESS B2");
// return p;
// } catch (Exception e) {
// Debug.Log("- PLUGIN FAIL B2 > " + e.Message);
// }
// return null;
// }
// Debug.Log("PLUGIN NOT FOUND");
// WP8.1 fix tries END
#endif

View File

@ -4,6 +4,9 @@
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
#if WP81
using DG.Tweening.Core.Surrogates;
#endif
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
@ -14,7 +17,11 @@ namespace DG.Tweening.Plugins.Core
internal static class SpecialPluginsUtils
{
// Returns TRUE if it's successful, FALSE otherwise
#if WP81
internal static bool SetLookAt(TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t)
#else
internal static bool SetLookAt(TweenerCore<Quaternion, Vector3, QuaternionOptions> t)
#endif
{
Transform trans = t.target as Transform;
Vector3 towards = t.endValue;

View File

@ -1,4 +1,5 @@
// Author: Daniele Giardini - http://www.demigiant.com
#if !WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2014/07/07 20:02
//
// License Copyright (c) Daniele Giardini.
@ -66,7 +67,7 @@ namespace DG.Tweening.Plugins
if (abs > 180) changeVal.z = changeVal.z > 0 ? -(360 - abs) : 360 - abs;
// - Assign
t.changeValue = changeVal;
} else if (t.plugOptions.rotateMode == RotateMode.FastBeyond360) {
} else if (t.plugOptions.rotateMode == RotateMode.FastBeyond360 || t.isRelative) {
t.changeValue = t.endValue - t.startValue;
} else {
t.changeValue = t.endValue;
@ -108,4 +109,5 @@ namespace DG.Tweening.Plugins
}
}
}
}
}
#endif

View File

@ -0,0 +1,111 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/15 12:32
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Plugins
{
public class QuaternionSurrogatePlugin : ABSTweenPlugin<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions>
{
public override void Reset(TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t) { }
public override void SetFrom(TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t, bool isRelative)
{
Vector3Surrogate prevEndVal = t.endValue;
t.endValue = ((Quaternion)t.getter()).eulerAngles;
if (t.plugOptions.rotateMode == RotateMode.Fast && !t.isRelative) {
t.startValue = prevEndVal;
} else if (t.plugOptions.rotateMode == RotateMode.FastBeyond360) {
t.startValue = t.endValue + prevEndVal;
} else {
QuaternionSurrogate rot = t.getter();
if (t.plugOptions.rotateMode == RotateMode.WorldAxisAdd) {
t.startValue = ((Quaternion)rot * Quaternion.Inverse(rot) * Quaternion.Euler(prevEndVal) * (Quaternion)rot).eulerAngles;
} else {
t.startValue = ((Quaternion)rot * Quaternion.Euler(prevEndVal)).eulerAngles;
}
t.endValue = -prevEndVal;
}
t.setter(Quaternion.Euler(t.startValue));
}
public override Vector3Surrogate ConvertToStartValue(TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t, QuaternionSurrogate value)
{
return ((Quaternion)value).eulerAngles;
}
public override void SetRelativeEndValue(TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t)
{
t.endValue += t.startValue;
}
public override void SetChangeValue(TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t)
{
if (t.plugOptions.rotateMode == RotateMode.Fast && !t.isRelative) {
// Rotation will be adapted to 360° and will take the shortest route
// - Adapt to 360°
Vector3Surrogate ev = t.endValue;
if (ev.x > 360) ev.x = ev.x % 360;
if (ev.y > 360) ev.y = ev.y % 360;
if (ev.z > 360) ev.z = ev.z % 360;
Vector3Surrogate changeVal = ev - t.startValue;
// - Find shortest rotation
float abs = (changeVal.x > 0 ? changeVal.x : -changeVal.x);
if (abs > 180) changeVal.x = changeVal.x > 0 ? -(360 - abs) : 360 - abs;
abs = (changeVal.y > 0 ? changeVal.y : -changeVal.y);
if (abs > 180) changeVal.y = changeVal.y > 0 ? -(360 - abs) : 360 - abs;
abs = (changeVal.z > 0 ? changeVal.z : -changeVal.z);
if (abs > 180) changeVal.z = changeVal.z > 0 ? -(360 - abs) : 360 - abs;
// - Assign
t.changeValue = changeVal;
} else if (t.plugOptions.rotateMode == RotateMode.FastBeyond360 || t.isRelative) {
t.changeValue = t.endValue - t.startValue;
} else {
t.changeValue = t.endValue;
}
}
public override float GetSpeedBasedDuration(QuaternionOptions options, float unitsXSecond, Vector3Surrogate changeValue)
{
return changeValue.magnitude / unitsXSecond;
}
public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<QuaternionSurrogate> getter, DOSetter<QuaternionSurrogate> setter, float elapsed, Vector3Surrogate startValue, Vector3Surrogate changeValue, float duration, bool usingInversePosition)
{
Vector3Surrogate endValue = startValue;
if (t.loopType == LoopType.Incremental) endValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
endValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1)
* (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
}
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
switch (options.rotateMode) {
case RotateMode.WorldAxisAdd:
case RotateMode.LocalAxisAdd:
QuaternionSurrogate startRot = Quaternion.Euler(startValue); // Reset rotation
endValue.x = changeValue.x * easeVal;
endValue.y = changeValue.y * easeVal;
endValue.z = changeValue.z * easeVal;
if (options.rotateMode == RotateMode.WorldAxisAdd) setter((Quaternion)startRot * Quaternion.Inverse(startRot) * Quaternion.Euler(endValue) * (Quaternion)startRot);
else setter((Quaternion)startRot * Quaternion.Euler(endValue));
break;
default:
endValue.x += changeValue.x * easeVal;
endValue.y += changeValue.y * easeVal;
endValue.z += changeValue.z * easeVal;
setter(Quaternion.Euler(endValue));
break;
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
// Author: Daniele Giardini - http://www.demigiant.com
#if !WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2014/07/10 16:51
//
// License Copyright (c) Daniele Giardini.
@ -106,4 +107,5 @@ namespace DG.Tweening.Plugins
}
}
}
}
}
#endif

View File

@ -0,0 +1,109 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/14 12:46
using System;
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Plugins
{
public class Vector2SurrogatePlugin : ABSTweenPlugin<Vector2Surrogate, Vector2Surrogate, VectorOptions>
{
public override void Reset(TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> t) { }
public override void SetFrom(TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> t, bool isRelative)
{
Vector2Surrogate prevEndVal = t.endValue;
t.endValue = t.getter();
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
Vector2Surrogate to = t.endValue;
switch (t.plugOptions.axisConstraint) {
case AxisConstraint.X:
to.x = t.startValue.x;
break;
case AxisConstraint.Y:
to.y = t.startValue.y;
break;
default:
to = t.startValue;
break;
}
if (t.plugOptions.snapping) {
to.x = (float)Math.Round(to.x);
to.y = (float)Math.Round(to.y);
}
t.setter(to);
}
public override Vector2Surrogate ConvertToStartValue(TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> t, Vector2Surrogate value)
{
return value;
}
public override void SetRelativeEndValue(TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> t)
{
t.endValue += t.startValue;
}
public override void SetChangeValue(TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> t)
{
switch (t.plugOptions.axisConstraint) {
case AxisConstraint.X:
t.changeValue = new Vector2Surrogate(t.endValue.x - t.startValue.x, 0);
break;
case AxisConstraint.Y:
t.changeValue = new Vector2Surrogate(0, t.endValue.y - t.startValue.y);
break;
default:
t.changeValue = t.endValue - t.startValue;
break;
}
}
public override float GetSpeedBasedDuration(VectorOptions options, float unitsXSecond, Vector2Surrogate changeValue)
{
return changeValue.magnitude / unitsXSecond;
}
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2Surrogate> getter, DOSetter<Vector2Surrogate> setter, float elapsed, Vector2Surrogate startValue, Vector2Surrogate changeValue, float duration, bool usingInversePosition)
{
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1)
* (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
}
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
switch (options.axisConstraint) {
case AxisConstraint.X:
Vector2Surrogate resX = getter();
resX.x = startValue.x + changeValue.x * easeVal;
if (options.snapping) resX.x = (float)Math.Round(resX.x);
setter(resX);
break;
case AxisConstraint.Y:
Vector2Surrogate resY = getter();
resY.y = startValue.y + changeValue.y * easeVal;
if (options.snapping) resY.y = (float)Math.Round(resY.y);
setter(resY);
break;
default:
startValue.x += changeValue.x * easeVal;
startValue.y += changeValue.y * easeVal;
if (options.snapping) {
startValue.x = (float)Math.Round(startValue.x);
startValue.y = (float)Math.Round(startValue.y);
}
setter(startValue);
break;
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
// Author: Daniele Giardini - http://www.demigiant.com
#if !WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2014/05/06 19:35
//
// License Copyright (c) Daniele Giardini.
@ -121,4 +122,5 @@ namespace DG.Tweening.Plugins
}
}
}
}
}
#endif

View File

@ -0,0 +1,123 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/14 12:44
using System;
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options;
#pragma warning disable 1591
namespace DG.Tweening.Plugins
{
public class Vector3SurrogatePlugin : ABSTweenPlugin<Vector3Surrogate, Vector3Surrogate, VectorOptions>
{
public override void Reset(TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t) { }
public override void SetFrom(TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t, bool isRelative)
{
Vector3Surrogate prevEndVal = t.endValue;
t.endValue = t.getter();
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
Vector3Surrogate to = t.endValue;
switch (t.plugOptions.axisConstraint) {
case AxisConstraint.X:
to.x = t.startValue.x;
break;
case AxisConstraint.Y:
to.y = t.startValue.y;
break;
case AxisConstraint.Z:
to.z = t.startValue.z;
break;
default:
to = t.startValue;
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 Vector3Surrogate ConvertToStartValue(TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t, Vector3Surrogate value)
{
return value;
}
public override void SetRelativeEndValue(TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t)
{
t.endValue += t.startValue;
}
public override void SetChangeValue(TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t)
{
switch (t.plugOptions.axisConstraint) {
case AxisConstraint.X:
t.changeValue = new Vector3Surrogate(t.endValue.x - t.startValue.x, 0, 0);
break;
case AxisConstraint.Y:
t.changeValue = new Vector3Surrogate(0, t.endValue.y - t.startValue.y, 0);
break;
case AxisConstraint.Z:
t.changeValue = new Vector3Surrogate(0, 0, t.endValue.z - t.startValue.z);
break;
default:
t.changeValue = t.endValue - t.startValue;
break;
}
}
public override float GetSpeedBasedDuration(VectorOptions options, float unitsXSecond, Vector3Surrogate changeValue)
{
return changeValue.magnitude / unitsXSecond;
}
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3Surrogate> getter, DOSetter<Vector3Surrogate> setter, float elapsed, Vector3Surrogate startValue, Vector3Surrogate changeValue, float duration, bool usingInversePosition)
{
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1)
* (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
}
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
switch (options.axisConstraint) {
case AxisConstraint.X:
Vector3Surrogate resX = getter();
resX.x = startValue.x + changeValue.x * easeVal;
if (options.snapping) resX.x = (float)Math.Round(resX.x);
setter(resX);
break;
case AxisConstraint.Y:
Vector3Surrogate resY = getter();
resY.y = startValue.y + changeValue.y * easeVal;
if (options.snapping) resY.y = (float)Math.Round(resY.y);
setter(resY);
break;
case AxisConstraint.Z:
Vector3Surrogate resZ = getter();
resZ.z = startValue.z + changeValue.z * easeVal;
if (options.snapping) resZ.z = (float)Math.Round(resZ.z);
setter(resZ);
break;
default:
startValue.x += changeValue.x * easeVal;
startValue.y += changeValue.y * easeVal;
startValue.z += changeValue.z * easeVal;
if (options.snapping) {
startValue.x = (float)Math.Round(startValue.x);
startValue.y = (float)Math.Round(startValue.y);
startValue.z = (float)Math.Round(startValue.z);
}
setter(startValue);
break;
}
}
}
}
#endif

View File

@ -1,4 +1,5 @@
// Author: Daniele Giardini - http://www.demigiant.com
#if !WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2014/07/10 16:53
//
// License Copyright (c) Daniele Giardini.
@ -136,4 +137,5 @@ namespace DG.Tweening.Plugins
}
}
}
}
}
#endif

View File

@ -0,0 +1,139 @@
#if WP81
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/04/14 12:19
using System;
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Plugins
{
public class Vector4SurrogatePlugin : ABSTweenPlugin<Vector4Surrogate, Vector4Surrogate, VectorOptions>
{
public override void Reset(TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> t) { }
public override void SetFrom(TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> t, bool isRelative)
{
Vector4Surrogate prevEndVal = t.endValue;
t.endValue = t.getter();
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
Vector4Surrogate to = t.endValue;
switch (t.plugOptions.axisConstraint) {
case AxisConstraint.X:
to.x = t.startValue.x;
break;
case AxisConstraint.Y:
to.y = t.startValue.y;
break;
case AxisConstraint.Z:
to.z = t.startValue.z;
break;
case AxisConstraint.W:
to.w = t.startValue.w;
break;
default:
to = t.startValue;
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 Vector4Surrogate ConvertToStartValue(TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> t, Vector4Surrogate value)
{
return value;
}
public override void SetRelativeEndValue(TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> t)
{
t.endValue += t.startValue;
}
public override void SetChangeValue(TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> t)
{
switch (t.plugOptions.axisConstraint) {
case AxisConstraint.X:
t.changeValue = new Vector4Surrogate(t.endValue.x - t.startValue.x, 0, 0, 0);
break;
case AxisConstraint.Y:
t.changeValue = new Vector4Surrogate(0, t.endValue.y - t.startValue.y, 0, 0);
break;
case AxisConstraint.Z:
t.changeValue = new Vector4Surrogate(0, 0, t.endValue.z - t.startValue.z, 0);
break;
case AxisConstraint.W:
t.changeValue = new Vector4Surrogate(0, 0, 0, t.endValue.w - t.startValue.w);
break;
default:
t.changeValue = t.endValue - t.startValue;
break;
}
}
public override float GetSpeedBasedDuration(VectorOptions options, float unitsXSecond, Vector4Surrogate changeValue)
{
return changeValue.magnitude / unitsXSecond;
}
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4Surrogate> getter, DOSetter<Vector4Surrogate> setter, float elapsed, Vector4Surrogate startValue, Vector4Surrogate changeValue, float duration, bool usingInversePosition)
{
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1)
* (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops);
}
float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
switch (options.axisConstraint) {
case AxisConstraint.X:
Vector4Surrogate resX = getter();
resX.x = startValue.x + changeValue.x * easeVal;
if (options.snapping) resX.x = (float)Math.Round(resX.x);
setter(resX);
break;
case AxisConstraint.Y:
Vector4Surrogate resY = getter();
resY.y = startValue.y + changeValue.y * easeVal;
if (options.snapping) resY.y = (float)Math.Round(resY.y);
setter(resY);
break;
case AxisConstraint.Z:
Vector4Surrogate resZ = getter();
resZ.z = startValue.z + changeValue.z * easeVal;
if (options.snapping) resZ.z = (float)Math.Round(resZ.z);
setter(resZ);
break;
case AxisConstraint.W:
Vector4Surrogate resW = getter();
resW.w = startValue.w + changeValue.w * easeVal;
if (options.snapping) resW.w = (float)Math.Round(resW.w);
setter(resW);
break;
default:
startValue.x += changeValue.x * easeVal;
startValue.y += changeValue.y * easeVal;
startValue.z += changeValue.z * easeVal;
startValue.w += changeValue.w * easeVal;
if (options.snapping) {
startValue.x = (float)Math.Round(startValue.x);
startValue.y = (float)Math.Round(startValue.y);
startValue.z = (float)Math.Round(startValue.z);
startValue.w = (float)Math.Round(startValue.w);
}
setter(startValue);
break;
}
}
}
}
#endif

View File

@ -4,6 +4,9 @@
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
#if WP81
using DG.Tweening.Core.Surrogates;
#endif
using System.Collections.Generic;
using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
@ -235,7 +238,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
return DOTween.To(() => target.position, x=> target.MovePosition(x), endValue, duration)
#else
return DOTween.To(() => target.position, target.MovePosition, endValue, duration)
#endif
.SetOptions(snapping).SetTarget(target);
}
@ -245,7 +252,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
return DOTween.To(() => target.position, x => target.MovePosition(x), new Vector3(endValue, 0, 0), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration)
#endif
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
}
@ -255,7 +266,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
return DOTween.To(() => target.position, x => target.MovePosition(x), new Vector3(0, endValue, 0), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration)
#endif
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
}
@ -265,7 +280,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
return DOTween.To(() => target.position, x => target.MovePosition(x), new Vector3(0, 0, endValue), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration)
#endif
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
}
@ -275,7 +294,11 @@ namespace DG.Tweening
/// <param name="mode">Rotation mode</param>
public static Tweener DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
#if WP81
TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), endValue, duration);
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
#endif
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
@ -288,7 +311,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), towards, duration)
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
#endif
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
t.plugOptions.axisConstraint = axisConstraint;
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
@ -411,7 +438,11 @@ namespace DG.Tweening
/// <param name="mode">Rotation mode</param>
public static Tweener DORotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
#if WP81
TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, endValue, duration);
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, endValue, duration);
#endif
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
@ -423,7 +454,11 @@ namespace DG.Tweening
/// <param name="mode">Rotation mode</param>
public static Tweener DOLocalRotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
#if WP81
TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t = DOTween.To(() => target.localRotation, x => target.localRotation = x, endValue, duration);
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.localRotation, x => target.localRotation = x, endValue, duration);
#endif
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
@ -483,7 +518,11 @@ namespace DG.Tweening
/// <param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
public static Tweener DOLookAt(this Transform target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
{
#if WP81
TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, towards, duration)
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, towards, duration)
#endif
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
t.plugOptions.axisConstraint = axisConstraint;
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
@ -664,8 +703,115 @@ namespace DG.Tweening
return t;
}
#endregion
#region Blendables
#region Light
/// <summary>Tweens a Light's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Light as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Light target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#region Material
/// <summary>Tweens a Material's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Material target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a Material's named color property to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</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>
public static Tweener DOBlendableColor(this Material target, Color endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.SetColor(property, target.GetColor(property) + diff);
}, endValue, duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a Material's alpha BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
/// instead than fight each other as multiple DOFade would do.
/// Also stores the Material as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableFadeBy(this Material target, float byValue, float duration)
{
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to.a = x.a;
target.color += diff;
}, new Color(0, 0, 0, byValue), duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a Material's named alpha property BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
/// instead than fight each other as multiple DOFade would do.
/// Also stores the Material as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</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>
public static Tweener DOBlendableFadeBy(this Material target, float byValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to.a = x.a;
target.SetColor(property, target.GetColor(property) + diff);
}, new Color(0, 0, 0, byValue), duration)
.Blendable().SetTarget(target);
}
#endregion
#region Transform
/// <summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableMove tweens to work together on the same target,
/// instead than fight each other as multiple DOMove would do.
@ -674,12 +820,21 @@ namespace DG.Tweening
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOBlendableMoveBy(this Transform target, Vector3 byValue, float duration, bool snapping = false)
{
#if WP81
Vector3Surrogate to = Vector3Surrogate.zero;
return DOTween.To(() => to, x => {
Vector3 diff = x - to;
to = x;
target.position += diff;
}, byValue, duration)
#else
Vector3 to = Vector3.zero;
return DOTween.To(() => to, x => {
Vector3 diff = x - to;
to = x;
target.position += diff;
}, byValue, duration)
#endif
.Blendable().SetOptions(snapping).SetTarget(target);
}
@ -691,12 +846,21 @@ namespace DG.Tweening
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOBlendableLocalMoveBy(this Transform target, Vector3 byValue, float duration, bool snapping = false)
{
#if WP81
Vector3Surrogate to = Vector3Surrogate.zero;
return DOTween.To(() => to, x => {
Vector3 diff = x - to;
to = x;
target.localPosition += diff;
}, byValue, duration)
#else
Vector3 to = Vector3.zero;
return DOTween.To(() => to, x => {
Vector3 diff = x - to;
to = x;
target.localPosition += diff;
}, byValue, duration)
#endif
.Blendable().SetOptions(snapping).SetTarget(target);
}
@ -709,8 +873,12 @@ namespace DG.Tweening
public static Tweener DOBlendableRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast)
{
Quaternion to = target.rotation;
#if WP81
TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t = DOTween.To(() => to, x => {
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => to, x => {
Quaternion diff = x * Quaternion.Inverse(to);
#endif
Quaternion diff = (Quaternion)x * Quaternion.Inverse(to);
to = x;
target.rotation = target.rotation * Quaternion.Inverse(target.rotation) * diff * target.rotation;
}, byValue, duration)
@ -728,8 +896,12 @@ namespace DG.Tweening
public static Tweener DOBlendableLocalRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast)
{
Quaternion to = target.localRotation;
#if WP81
TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t = DOTween.To(() => to, x => {
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => to, x => {
Quaternion diff = x * Quaternion.Inverse(to);
#endif
Quaternion diff = (Quaternion)x * Quaternion.Inverse(to);
to = x;
target.localRotation = target.localRotation * Quaternion.Inverse(target.localRotation) * diff * target.localRotation;
}, byValue, duration)
@ -745,12 +917,21 @@ namespace DG.Tweening
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableScaleBy(this Transform target, Vector3 byValue, float duration)
{
#if WP81
Vector3Surrogate to = Vector3Surrogate.zero;
return DOTween.To(() => to, x => {
Vector3 diff = x - to;
to = x;
target.localScale += diff;
}, byValue, duration)
#else
Vector3 to = Vector3.zero;
return DOTween.To(() => to, x => {
Vector3 diff = x - to;
to = x;
target.localScale += diff;
}, byValue, duration)
#endif
.Blendable().SetTarget(target);
}

View File

@ -4,6 +4,9 @@
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
#if WP81
using DG.Tweening.Core.Surrogates;
#endif
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Plugins;
@ -581,7 +584,11 @@ namespace DG.Tweening
/// <summary>Options for Vector2 tweens</summary>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> t, bool snapping)
#else
public static Tweener SetOptions(this TweenerCore<Vector2, Vector2, VectorOptions> t, bool snapping)
#endif
{
if (t == null || !t.active) return t;
@ -591,7 +598,11 @@ namespace DG.Tweening
/// <summary>Options for Vector2 tweens</summary>
/// <param name="axisConstraint">Selecting an axis will tween the vector only on that axis, leaving the others untouched</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<Vector2Surrogate, Vector2Surrogate, VectorOptions> t, AxisConstraint axisConstraint, bool snapping = false)
#else
public static Tweener SetOptions(this TweenerCore<Vector2, Vector2, VectorOptions> t, AxisConstraint axisConstraint, bool snapping = false)
#endif
{
if (t == null || !t.active) return t;
@ -602,7 +613,11 @@ namespace DG.Tweening
/// <summary>Options for Vector3 tweens</summary>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t, bool snapping)
#else
public static Tweener SetOptions(this TweenerCore<Vector3, Vector3, VectorOptions> t, bool snapping)
#endif
{
if (t == null || !t.active) return t;
@ -612,7 +627,11 @@ namespace DG.Tweening
/// <summary>Options for Vector3 tweens</summary>
/// <param name="axisConstraint">Selecting an axis will tween the vector only on that axis, leaving the others untouched</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<Vector3Surrogate, Vector3Surrogate, VectorOptions> t, AxisConstraint axisConstraint, bool snapping = false)
#else
public static Tweener SetOptions(this TweenerCore<Vector3, Vector3, VectorOptions> t, AxisConstraint axisConstraint, bool snapping = false)
#endif
{
if (t == null || !t.active) return t;
@ -623,7 +642,11 @@ namespace DG.Tweening
/// <summary>Options for Vector4 tweens</summary>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> t, bool snapping)
#else
public static Tweener SetOptions(this TweenerCore<Vector4, Vector4, VectorOptions> t, bool snapping)
#endif
{
if (t == null || !t.active) return t;
@ -633,7 +656,11 @@ namespace DG.Tweening
/// <summary>Options for Vector4 tweens</summary>
/// <param name="axisConstraint">Selecting an axis will tween the vector only on that axis, leaving the others untouched</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<Vector4Surrogate, Vector4Surrogate, VectorOptions> t, AxisConstraint axisConstraint, bool snapping = false)
#else
public static Tweener SetOptions(this TweenerCore<Vector4, Vector4, VectorOptions> t, AxisConstraint axisConstraint, bool snapping = false)
#endif
{
if (t == null || !t.active) return t;
@ -645,7 +672,11 @@ namespace DG.Tweening
/// <summary>Options for Quaternion tweens</summary>
/// <param name="useShortest360Route">If TRUE (default) the rotation will take the shortest route, and will not rotate more than 360°.
/// If FALSE the rotation will be fully accounted. Is always FALSE if the tween is set as relative</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions> t, bool useShortest360Route = true)
#else
public static Tweener SetOptions(this TweenerCore<Quaternion, Vector3, QuaternionOptions> t, bool useShortest360Route = true)
#endif
{
if (t == null || !t.active) return t;
@ -655,7 +686,11 @@ namespace DG.Tweening
/// <summary>Options for Color tweens</summary>
/// <param name="alphaOnly">If TRUE only the alpha value of the color will be tweened</param>
#if WP81
public static Tweener SetOptions(this TweenerCore<ColorSurrogate, ColorSurrogate, ColorOptions> t, bool alphaOnly)
#else
public static Tweener SetOptions(this TweenerCore<Color, Color, ColorOptions> t, bool alphaOnly)
#endif
{
if (t == null || !t.active) return t;

View File

@ -4,6 +4,9 @@
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
#if WP81
using DG.Tweening.Core.Surrogates;
#endif
using System;
using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
@ -75,37 +78,43 @@ namespace DG.Tweening
return false;
}
#else
// WP8.1 fix tries
if (t.tweenPlugin == null) {
Debug.Log("Assigning plugin to ABSTweenPlugin<T1, T2, TPlugOptions> var");
ABSTweenPlugin<T1, T2, TPlugOptions> plug = PluginsManager.GetDefaultPlugin<T1, T2, TPlugOptions>();
if (plug != null) {
Debug.Log(">> Plugin found");
t.tweenPlugin = plug;
Debug.Log(">> Plugin assigned > " + t.tweenPlugin + " (t.tweenPlugin is null: " + (t.tweenPlugin == null) + ")");
if (t.tweenPlugin == null) Debug.Log(">> Plugin assignment failed");
} else Debug.Log(">> Plugin NOT found");
}
if (t.tweenPlugin == null) {
Debug.Log("Assigning plugin to ITweenPlugin var");
ITweenPlugin iplug = PluginsManager.GetDefaultPlugin<T1, T2, TPlugOptions>();
if (iplug != null) {
Debug.Log(">> IPlugin found");
try {
System.Object pObj = (object)iplug;
t.tweenPlugin = (ABSTweenPlugin<T1, T2, TPlugOptions>)pObj;
} catch (Exception e) {
Debug.Log(">> Error while assigning IPlugin > " + e.Message);
}
Debug.Log(">> IPlugin assigned > " + t.tweenPlugin + " (t.tweenPlugin is null: " + (t.tweenPlugin == null) + ")");
if (t.tweenPlugin == null) Debug.Log(">> IPlugin assignment failed");
} else Debug.Log(">> IPlugin NOT found");
}
if (t.tweenPlugin == null) t.tweenPlugin = PluginsManager.GetDefaultPlugin<T1, T2, TPlugOptions>();
if (t.tweenPlugin == null) {
// No suitable plugin found. Kill
Debugger.LogError("No suitable plugin found for this type");
Debugger.LogError(string.Format("No suitable plugin found for this type (<{0}, {1}, {2}>)", typeof(T1), typeof(T2), typeof(TPlugOptions)));
return false;
}
// WP8.1 fix tries
// if (t.tweenPlugin == null) {
// Debug.Log("Assigning plugin to ABSTweenPlugin<T1, T2, TPlugOptions> var");
// ABSTweenPlugin<T1, T2, TPlugOptions> plug = PluginsManager.GetDefaultPlugin<T1, T2, TPlugOptions>();
// if (plug != null) {
// Debug.Log(">> Plugin found");
// t.tweenPlugin = plug;
// Debug.Log(">> Plugin assigned > " + t.tweenPlugin + " (t.tweenPlugin is null: " + (t.tweenPlugin == null) + ")");
// if (t.tweenPlugin == null) Debug.Log(">> Plugin assignment failed");
// } else Debug.Log(">> Plugin NOT found");
// }
// if (t.tweenPlugin == null) {
// Debug.Log("Assigning plugin to ITweenPlugin var");
// ITweenPlugin iplug = PluginsManager.GetDefaultPlugin<T1, T2, TPlugOptions>();
// if (iplug != null) {
// Debug.Log(">> IPlugin found");
// try {
// System.Object pObj = (object)iplug;
// t.tweenPlugin = (ABSTweenPlugin<T1, T2, TPlugOptions>)pObj;
// } catch (Exception e) {
// Debug.Log(">> Error while assigning IPlugin > " + e.Message);
// }
// Debug.Log(">> IPlugin assigned > " + t.tweenPlugin + " (t.tweenPlugin is null: " + (t.tweenPlugin == null) + ")");
// if (t.tweenPlugin == null) Debug.Log(">> IPlugin assignment failed");
// } else Debug.Log(">> IPlugin NOT found");
// }
// if (t.tweenPlugin == null) {
// // No suitable plugin found. Kill
// Debugger.LogError("No suitable plugin found for this type");
// return false;
// }
// WP8.1 fix tries END
#endif
}
@ -277,7 +286,11 @@ namespace DG.Tweening
try {
switch (t.specialStartupMode) {
case SpecialStartupMode.SetLookAt:
#if WP81
if (!SpecialPluginsUtils.SetLookAt(t as TweenerCore<QuaternionSurrogate, Vector3Surrogate, QuaternionOptions>)) return false;
#else
if (!SpecialPluginsUtils.SetLookAt(t as TweenerCore<Quaternion, Vector3, QuaternionOptions>)) return false;
#endif
break;
case SpecialStartupMode.SetPunch:
if (!SpecialPluginsUtils.SetPunch(t as TweenerCore<Vector3, Vector3[], Vector3ArrayOptions>)) return false;

View File

@ -36,7 +36,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'WP81|AnyCPU'">
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;WP81</DefineConstants>
<DocumentationFile>..\bin\DOTween43.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>1573</NoWarn>

View File

@ -46,7 +46,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
return DOTween.To(() => target.position, x=> target.MovePosition(x), endValue, duration)
#else
return DOTween.To(() => target.position, target.MovePosition, endValue, duration)
#endif
.SetOptions(snapping).SetTarget(target);
}
@ -56,7 +60,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
return DOTween.To(() => target.position, x => target.MovePosition(x), new Vector2(endValue, 0), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration)
#endif
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
}
@ -66,7 +74,11 @@ namespace DG.Tweening
/// <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)
{
#if WP81
return DOTween.To(() => target.position, x => target.MovePosition(x), new Vector2(0, endValue), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration)
#endif
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
}
@ -80,5 +92,46 @@ namespace DG.Tweening
}
#endregion
#region Blendables
#region SpriteRenderer
/// <summary>Tweens a SpriteRenderer's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this SpriteRenderer target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a SpriteRenderer's alpha BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
/// instead than fight each other as multiple DOFade would do.
/// Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableFadeBy(this SpriteRenderer target, float byValue, float duration)
{
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to.a = x.a;
target.color += diff;
}, new Color(0, 0, 0, byValue), duration)
.Blendable().SetTarget(target);
}
#endregion
#endregion
}
}

View File

@ -244,5 +244,120 @@ namespace DG.Tweening
#endregion
#endregion
#region Blendables
#region Graphic
/// <summary>Tweens a Graphic's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Graphic target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a Graphic's alpha BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
/// instead than fight each other as multiple DOFade would do.
/// Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableFadeBy(this Graphic target, float byValue, float duration)
{
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to.a = x.a;
target.color += diff;
}, new Color(0, 0, 0, byValue), duration)
.Blendable().SetTarget(target);
}
#endregion
#region Image
/// <summary>Tweens a Image's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Image as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Image target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a Image's alpha BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
/// instead than fight each other as multiple DOFade would do.
/// Also stores the Image as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableFadeBy(this Image target, float byValue, float duration)
{
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to.a = x.a;
target.color += diff;
}, new Color(0, 0, 0, byValue), duration)
.Blendable().SetTarget(target);
}
#endregion
#region Text
/// <summary>Tweens a Text's color BY the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Text target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a Text's alpha BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
/// instead than fight each other as multiple DOFade would do.
/// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableFadeBy(this Text target, float byValue, float duration)
{
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
Color diff = x - to;
to.a = x.a;
target.color += diff;
}, new Color(0, 0, 0, byValue), duration)
.Blendable().SetTarget(target);
}
#endregion
#endregion
}
}

View File

@ -36,7 +36,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'WP81|AnyCPU'">
<OutputPath>..\bin\Editor\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;WP81</DefineConstants>
<DocumentationFile>..\bin\Editor\DOTweenEditor.XML</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>1591</NoWarn>

View File

@ -80,7 +80,11 @@ namespace DG.DOTweenEditor
void OnEnable()
{
#if WP81
_innerTitle = "DOTween v" + DOTween.Version + (DOTween.isDebugBuild ? " [Debug WP8.1 build]" : " [Release WP8.1 build]");
#else
_innerTitle = "DOTween v" + DOTween.Version + (DOTween.isDebugBuild ? " [Debug build]" : " [Release build]");
#endif
if (EditorUtils.hasPro) _innerTitle += "\nDOTweenPro v" + EditorUtils.proVersion;
else _innerTitle += "\nDOTweenPro not installed";

View File

@ -1183,6 +1183,45 @@
Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
<param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Light,UnityEngine.Color,System.Single)">
<summary>Tweens a Light's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Light as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.Single)">
<summary>Tweens a Material's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.Material,UnityEngine.Color,System.String,System.Single)">
<summary>Tweens a Material's named color property to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.Single)">
<summary>Tweens a Material's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.Material,System.Single,System.String,System.Single)">
<summary>Tweens a Material's named alpha property BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the Material as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableMoveBy(UnityEngine.Transform,UnityEngine.Vector3,System.Single,System.Boolean)">
<summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableMove tweens to work together on the same target,

Binary file not shown.

Binary file not shown.

View File

@ -43,5 +43,19 @@
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>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
<summary>Tweens a SpriteRenderer's color to the given value,
in a way that allows other DOBlendableColor tweens to work together on the same target,
instead than fight each other as multiple DOColor would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions.DOBlendableFadeBy(UnityEngine.SpriteRenderer,System.Single,System.Single)">
<summary>Tweens a SpriteRenderer's alpha BY the given value (as if you chained a <code>SetRelative</code>),
in a way that allows other DOBlendableFadeBy tweens to work together on the same target,
instead than fight each other as multiple DOFade would do.
Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
</member>
</members>
</doc>

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More