Пример #1
0
 public static void TweenUIColor(Graphic graphic, Color to, float time, System.Action onFinish = null)
 {
     XTween.Tween(graphic.color, to, time, null, onFinish,
                  (a, b, t) =>
     {
         graphic.color = Color.Lerp(a, b, t);
     });
 }
Пример #2
0
 public static void TweenPosition(Transform trans, Vector3 to, float time, System.Action onFinish = null)
 {
     XTween.Tween(trans.position, to, time, null, onFinish,
                  (a, b, t) =>
     {
         trans.position = Vector3.Lerp(a, b, t);
     });
 }
Пример #3
0
 public static void TweenScale(Transform trans, Vector3 to, float time, System.Action onFinish = null)
 {
     XTween.Tween(trans.localScale, to, time, null, onFinish,
                  (a, b, t) =>
     {
         trans.localScale = Vector3.Lerp(a, b, t);
     });
 }
Пример #4
0
 public static void TweenRotation(Transform trans, Quaternion to, float time, System.Action onFinish = null)
 {
     XTween.Tween(trans.rotation, to, time, null, onFinish,
                  (a, b, t) =>
     {
         trans.rotation = Quaternion.Lerp(a, b, t);
     });
 }
Пример #5
0
 public static void TweenMaterialColor(Material mat, string property, Color to, float time, System.Action onFinish = null)
 {
     XTween.Tween(mat.GetColor(property), to, time, null, onFinish,
                  (a, b, t) =>
     {
         Color v = Color.Lerp(a, b, t);
         mat.SetColor(property, v);
     });
 }
Пример #6
0
 public static void TweenMaterialVector(Material mat, string property, Vector4 to, float time, System.Action onFinish = null)
 {
     XTween.Tween(mat.GetVector(property), to, time, null, onFinish,
                  (a, b, t) =>
     {
         Vector4 v = Vector4.Lerp(a, b, t);
         mat.SetVector(property, v);
     });
 }
Пример #7
0
 public static void TweenMaterialFloat(Material mat, string property, float to, float time, System.Action onFinish = null)
 {
     XTween.Tween(mat.GetFloat(property), to, time, null, onFinish,
                  (a, b, t) =>
     {
         float v = Mathf.Lerp(a, b, t);
         mat.SetFloat(property, v);
     });
 }
Пример #8
0
 public static void TweenUIAlpha(CanvasGroup group, float to, float time, System.Action onFinish = null)
 {
     XTween.Tween(group.alpha, to, time, null, onFinish,
                  (a, b, t) =>
     {
         float v     = Mathf.Lerp(a, b, t);
         group.alpha = v;
     });
 }
Пример #9
0
 public static void TweenUIAlpha(Graphic graphic, float to, float time, System.Action onFinish = null)
 {
     XTween.Tween(graphic.color.a, to, time, null, onFinish,
                  (a, b, t) =>
     {
         Color c       = graphic.color;
         c.a           = Mathf.Lerp(a, b, t);
         graphic.color = c;
     });
 }
Пример #10
0
 public static void Tween <T>(T from, T to, float time, System.Action onStart, System.Action onFinish, System.Action <T, T, float> onUpdate)
 {
     XTween.Instance.StartCoroutine(
         XTween.TweenAsync(from, to, time, onStart, onFinish, onUpdate));
 }