Exemplo n.º 1
0
 public static async Task DoColorAsync(this TextMeshProUGUI text, Color toColor, float duration, Easing easing = Easing.Linear)
 {
     var startColor = text.color;
     var easeFunc   = EaseFunctions.Get(easing);
     await TweenExtensions.DoTweenAsync(text.gameObject.GetInstanceID(), duration,
                                        (t) => { text.color = Color.Lerp(startColor, toColor, t); }, easing);
 }
 public static async Task DoAnchorPosYAsync(this RectTransform rectTransform, float position, float duration, Easing easing = Easing.Linear)
 {
     var startPosY = rectTransform.anchoredPosition.y;
     await TweenExtensions.DoTweenAsync(rectTransform.gameObject.GetInstanceID(), duration, (t) =>
     {
         var pt = rectTransform.anchoredPosition;
         pt.y   = Mathf.Lerp(startPosY, position, t);
         rectTransform.anchoredPosition = pt;
     }, easing);
 }