1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-04 22:34:56 +08:00

Implemented WP8.1 fix with new DOBlendableColor shortcuts

This commit is contained in:
Daniele Giardini 2015-04-20 16:56:52 +02:00
parent 0cda757c93
commit a5b9515df9
47 changed files with 37 additions and 28 deletions

View File

@ -27,7 +27,6 @@ public class BlendableTweens : BrainBase
Vector3 to; Vector3 to;
Color toCol; Color toCol;
float toFloat;
float duration; float duration;
int loops; int loops;
@ -100,31 +99,6 @@ public class BlendableTweens : BrainBase
if (fromBlendable) sprites[0].DOBlendableColor(toCol, duration).From().SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetAutoKill(false).Pause(); 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(); 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() void OnGUI()

View File

@ -6,6 +6,7 @@
using UnityEngine; using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening.Core.Easing namespace DG.Tweening.Core.Easing
{ {
/// <summary> /// <summary>

View File

@ -24,7 +24,7 @@ namespace DG.Tweening
public class DOTween public class DOTween
{ {
/// <summary>DOTween's version</summary> /// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.531"; public static readonly string Version = "1.0.535";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -717,7 +717,11 @@ namespace DG.Tweening
public static Tweener DOBlendableColor(this Light target, Color endValue, float duration) public static Tweener DOBlendableColor(this Light target, Color endValue, float duration)
{ {
endValue = endValue - target.color; endValue = endValue - target.color;
#if WP81
ColorSurrogate to = new ColorSurrogate(0, 0, 0, 0);
#else
Color to = new Color(0, 0, 0, 0); Color to = new Color(0, 0, 0, 0);
#endif
return DOTween.To(() => to, x => { return DOTween.To(() => to, x => {
Color diff = x - to; Color diff = x - to;
to = x; to = x;
@ -738,7 +742,11 @@ namespace DG.Tweening
public static Tweener DOBlendableColor(this Material target, Color endValue, float duration) public static Tweener DOBlendableColor(this Material target, Color endValue, float duration)
{ {
endValue = endValue - target.color; endValue = endValue - target.color;
#if WP81
ColorSurrogate to = new ColorSurrogate(0, 0, 0, 0);
#else
Color to = new Color(0, 0, 0, 0); Color to = new Color(0, 0, 0, 0);
#endif
return DOTween.To(() => to, x => { return DOTween.To(() => to, x => {
Color diff = x - to; Color diff = x - to;
to = x; to = x;
@ -761,7 +769,11 @@ namespace DG.Tweening
} }
endValue = endValue - target.color; endValue = endValue - target.color;
#if WP81
ColorSurrogate to = new ColorSurrogate(0, 0, 0, 0);
#else
Color to = new Color(0, 0, 0, 0); Color to = new Color(0, 0, 0, 0);
#endif
return DOTween.To(() => to, x => { return DOTween.To(() => to, x => {
Color diff = x - to; Color diff = x - to;
to = x; to = x;

View File

@ -4,6 +4,9 @@
// License Copyright (c) Daniele Giardini. // License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php // 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;
using DG.Tweening.Core.Enums; using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -105,7 +108,11 @@ namespace DG.Tweening
public static Tweener DOBlendableColor(this SpriteRenderer target, Color endValue, float duration) public static Tweener DOBlendableColor(this SpriteRenderer target, Color endValue, float duration)
{ {
endValue = endValue - target.color; endValue = endValue - target.color;
#if WP81
ColorSurrogate to = new ColorSurrogate(0, 0, 0, 0);
#else
Color to = new Color(0, 0, 0, 0); Color to = new Color(0, 0, 0, 0);
#endif
return DOTween.To(() => to, x => { return DOTween.To(() => to, x => {
Color diff = x - to; Color diff = x - to;
to = x; to = x;

View File

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

View File

@ -4,6 +4,9 @@
// License Copyright (c) Daniele Giardini. // License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php // 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;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -257,7 +260,11 @@ namespace DG.Tweening
public static Tweener DOBlendableColor(this Graphic target, Color endValue, float duration) public static Tweener DOBlendableColor(this Graphic target, Color endValue, float duration)
{ {
endValue = endValue - target.color; endValue = endValue - target.color;
#if WP81
ColorSurrogate to = new ColorSurrogate(0, 0, 0, 0);
#else
Color to = new Color(0, 0, 0, 0); Color to = new Color(0, 0, 0, 0);
#endif
return DOTween.To(() => to, x => { return DOTween.To(() => to, x => {
Color diff = x - to; Color diff = x - to;
to = x; to = x;
@ -278,7 +285,11 @@ namespace DG.Tweening
public static Tweener DOBlendableColor(this Image target, Color endValue, float duration) public static Tweener DOBlendableColor(this Image target, Color endValue, float duration)
{ {
endValue = endValue - target.color; endValue = endValue - target.color;
#if WP81
ColorSurrogate to = new ColorSurrogate(0, 0, 0, 0);
#else
Color to = new Color(0, 0, 0, 0); Color to = new Color(0, 0, 0, 0);
#endif
return DOTween.To(() => to, x => { return DOTween.To(() => to, x => {
Color diff = x - to; Color diff = x - to;
to = x; to = x;
@ -299,7 +310,11 @@ namespace DG.Tweening
public static Tweener DOBlendableColor(this Text target, Color endValue, float duration) public static Tweener DOBlendableColor(this Text target, Color endValue, float duration)
{ {
endValue = endValue - target.color; endValue = endValue - target.color;
#if WP81
ColorSurrogate to = new ColorSurrogate(0, 0, 0, 0);
#else
Color to = new Color(0, 0, 0, 0); Color to = new Color(0, 0, 0, 0);
#endif
return DOTween.To(() => to, x => { return DOTween.To(() => to, x => {
Color diff = x - to; Color diff = x - to;
to = x; to = x;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.