DoTween 的 SetEase 设置缓冲类型:
各种类型的曲线:http://robertpenner.com/easing/easing_demo.html,,,
用的时候去点点看看,基本就可以知道想要的效果对应的那个曲线函数了。
函数名 | 描述 |
---|---|
BackEase | 略微收回动画的动作,然后再开始进行动画处理指示的路径中。 |
BounceEase | 创建弹跳效果。 |
CircleEase | 创建加速和/或减速使用循环函数的动画。 |
CubicEase | 创建加速和/或减速使用的公式的动画f(t) = t3。 |
ElasticEase | 创建类似于弹簧来回直到静止的动画。 |
ExponentialEase | 创建加速和/或减速使用指数公式的动画。 |
PowerEase | 创建加速和/或减速使用的公式的动画f(t) = tp其中 p 等于Power属性。 |
QuadraticEase | 创建加速和/或减速使用的公式的动画f(t) = t2。 |
QuarticEase | 创建加速和/或减速使用的公式的动画f(t) = t4。 |
QuinticEase | 创建加速和/或减速使用的公式的动画f(t) = t5。 |
SineEase | 创建加速和/或减速使用正弦公式的动画。 |
DoTween可以使用EasingMode属性更改缓动函数的行为方式,即更改动画的内插。 有三个可能的值可以为EasingMode:
EaseIn:内插遵循与缓动函数相关联的数学公式。
EaseOut:内插遵循 100%内插值减去输出与缓动函数相关联的公式。
EaseInOut:使用内插EaseIn动画的第一个另一半和EaseOut虚拟机。
#region 程序集 DOTween, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// E:\project\gus_client_2_0\Assets\Demigiant\DOTween\DOTween.dll
#endregion
namespace DG.Tweening
{
public enum Ease
{
Unset = 0,
Linear = 1,
InSine = 2,
OutSine = 3,
InOutSine = 4,
InQuad = 5,
OutQuad = 6,
InOutQuad = 7,
InCubic = 8,
OutCubic = 9,
InOutCubic = 10,
InQuart = 11,
OutQuart = 12,
InOutQuart = 13,
InQuint = 14,
OutQuint = 15,
InOutQuint = 16,
InExpo = 17,
OutExpo = 18,
InOutExpo = 19,
InCirc = 20,
OutCirc = 21,
InOutCirc = 22,
InElastic = 23,
OutElastic = 24,
InOutElastic = 25,
InBack = 26,
OutBack = 27,
InOutBack = 28,
InBounce = 29,
OutBounce = 30,
InOutBounce = 31,
//
// 摘要:
// Don't assign this! It's assigned automatically when creating 0 duration tweens
INTERNAL_Zero = 32,
//
// 摘要:
// Don't assign this! It's assigned automatically when setting the ease to an AnimationCurve
// or to a custom ease function
INTERNAL_Custom = 33
}
}
#region 先手动画
public void fristHand_Ani()
{
Fan_Img.gameObject.SetActive(true);
FristHand_Img.gameObject.SetActive(true);
FristHand_Img.transform.localScale = Vector3.one * 0.5f;
Fan_Img.DOFade(1, 0.01f);
Fan_Img.transform.localEulerAngles = Vector3.zero;//back * 10;
StartCoroutine("Invoke_YS");
}
IEnumerator Invoke_YS()
{
yield return new WaitForSeconds(0.2f);
FristHand_Img.DOFade(1, 0.02f);
//Tween te = Fan_Img.transform.DOLocalRotate(Vector3.forward * 10f, 0.3f);
//te.SetLoops(2, LoopType.Yoyo).SetEase(Ease.OutBounce).OnComplete(() =>
//{
// Fan_Img.transform.localEulerAngles = Vector3.zero;
// te.Kill();
//});
FristHand_Img.transform.DOScale(Vector3.one * 1f, 0.4f).SetEase(Ease.OutBounce).OnComplete(() =>
{
//隐藏 扇子和先手文字...
Fan_Img.DOFade(0, 0.2f);
FristHand_Img.DOFade(0, 0.2f).OnComplete(() =>
{
FristHand_Img.gameObject.SetActive(false);
Fan_Img.gameObject.SetActive(false);
StopCoroutine("MN_Update");
});
});
yield return new WaitForSeconds(0.4f);
// 先手落子 飞行动画...
Linght.transform.localPosition = Vector3.zero;
Linght.gameObject.SetActive(true);
Linght.DOFade(1, 0.02f).OnComplete(() =>
{
Vector3 target_v3;
if (model.Current_player == model.myuid)
{
target_v3 = new Vector3(-405, -800, 0);
Linght.transform.localEulerAngles = Vector3.forward * 30;
}
else
{
target_v3 = new Vector3(-355, 600, 0);
Linght.transform.localEulerAngles = Vector3.back * 70;
}
Linght.transform.DOScale(1f, 0.2f).OnComplete(() =>
{
Linght.transform.DOScale(0.6f, 0.2f);
Linght.DOFade(0, 0.2f);
});
Linght.transform.DOBlendableLocalMoveBy(target_v3, 0.4f).SetEase(Ease.InOutQuint);
});
yield return new WaitForSeconds(0.02f);
StopCoroutine("Invoke_YS");
}
#endregion