Ejemplo n.º 1
0
 public static Task WarpAndMoveTo(this Transform trans, Vector3 start, Vector3 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                  Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                  System.Action onComplete = null)
 {
     return(new Tween((Vector3 pos) => {
         trans.position = pos;
     }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
 }
Ejemplo n.º 2
0
 public static Coroutine WarpAndMoveTo(this Transform trans, Vector3 start, Vector3 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                       Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                       Action onComplete        = null)
 {
     return(TweenManager.instance.playTween(new Tween((Vector3 pos) => {
         trans.position = pos;
     }, start, target, length, easingChoice, unscaled, repeat, onComplete)));
 }
Ejemplo n.º 3
0
        public static Task EaseFill(this Image image, float target, float length, EasingTypes easingChoice, bool unscaled = false,
                                    Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                    System.Action onComplete = null)
        {
            float start = image.fillAmount;

            return(new Tween((float newFill) => {
                image.fillAmount = newFill;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
        }
Ejemplo n.º 4
0
        public static Task FadeTo(this TextMeshProUGUI cgroup, float target, float length, EasingTypes easingChoice, bool unscaled = false,
                                  Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                  System.Action onComplete = null)
        {
            float start = cgroup.alpha;

            return(new Tween((float newAlpha) => {
                cgroup.alpha = newAlpha;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
        }
Ejemplo n.º 5
0
        public static Task RotateTo(this Transform trans, Vector3 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                    Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                    System.Action onComplete = null)
        {
            Vector3 start = trans.localEulerAngles;

            return(new Tween((Vector3 rot) => {
                trans.localEulerAngles = rot;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
        }
Ejemplo n.º 6
0
        public static Task jump(this ScrollRect scrollRect, Vector2 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                System.Action onComplete = null)
        {
            Vector2 start = scrollRect.normalizedPosition;

            return(new Tween((Vector2 newPosition) => {
                scrollRect.normalizedPosition = newPosition;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
        }
Ejemplo n.º 7
0
        public static Coroutine jump(this ScrollRect scrollRect, Vector2 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                     Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                     Action onComplete        = null)
        {
            Vector2 start = scrollRect.normalizedPosition;

            return(TweenManager.instance.playTween(new Tween((Vector2 newPosition) => {
                scrollRect.normalizedPosition = newPosition;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete)));
        }
Ejemplo n.º 8
0
        public static Coroutine EaseFill(this Image image, float target, float length, EasingTypes easingChoice, bool unscaled = false,
                                         Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                         Action onComplete        = null)
        {
            float start = image.fillAmount;

            return(TweenManager.instance.playTween(new Tween((float newFill) => {
                image.fillAmount = newFill;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete)));
        }
Ejemplo n.º 9
0
        public static Coroutine FadeTo(this CanvasGroup cgroup, float target, float length, EasingTypes easingChoice, bool unscaled = false,
                                       Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                       Action onComplete        = null)
        {
            float start = cgroup.alpha;

            return(TweenManager.instance.playTween(new Tween((float newAlpha) => {
                cgroup.alpha = newAlpha;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete)));
        }
Ejemplo n.º 10
0
        public static Coroutine RotateTo(this Transform trans, Vector3 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                         Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                         Action onComplete        = null)
        {
            Vector3 start = trans.localEulerAngles;

            return(TweenManager.instance.playTween(new Tween((Vector3 rot) => {
                trans.localEulerAngles = rot;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete)));
        }
Ejemplo n.º 11
0
        public static Task ScaleTo(this Transform trans, Vector3 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                   Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                   Action onComplete        = null)
        {
            Vector3 start = trans.localScale;

            return(new Tween((Vector3 scale) => {
                trans.localScale = scale;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
        }
Ejemplo n.º 12
0
        public static Task EaseLayoutMinValues(this LayoutElement layout, Vector2 target, float length, EasingTypes easingChoice, bool unscaled = false,
                                               Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                               System.Action onComplete = null)
        {
            Vector2 start = new Vector2(layout.minWidth, layout.minHeight);

            return(new Tween((Vector2 newDimensions) => {
                layout.minWidth = newDimensions.x;
                layout.minHeight = newDimensions.y;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
        }
Ejemplo n.º 13
0
        public static Task FadeTo(this CanvasGroup cgroup, float target, float length, EasingTypes easingChoice, bool unscaled = false,
                                  Tween.TweenRepeat repeat = Tween.TweenRepeat.Once,
                                  System.Action onComplete = null)
        {
            float start = cgroup.alpha;

            return(new Tween((float newAlpha) => {
                cgroup.alpha = newAlpha;
                cgroup.interactable = newAlpha > 0.5f;
                cgroup.blocksRaycasts = newAlpha > 0.5f;
            }, start, target, length, easingChoice, unscaled, repeat, onComplete).Play());
        }