public void ApplyInputParameters(WindowComponentBase layoutElement) {

				var component = layoutElement.gameObject.AddComponent(System.Type.GetType("UnityEngine.UI.Windows.Animations." + this.transition.GetType().Name + "Parameters")) as TransitionInputParameters;
				component.SetDefaultParameters(this.GetDefaultInputParameters());
				layoutElement.animationInputParams.Add(component);

			}
예제 #2
0
        public void Play(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var delay = this.GetDelay(parameters, forward);
            var tag   = (window != null ? "_" + window.GetInstanceID().ToString() : string.Empty) +
                        (parameters != null ? ("_" + parameters.GetInstanceID().ToString()) : string.Empty) +
                        (root != null ? ("_" + root.GetInstanceID().ToString()) : string.Empty);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }

            if (delay > 0f && TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => {
                    this.OnPlay(window, tag, parameters, root, forward, callback);
                }).onCancel((obj) => {
                    if (callback != null)
                    {
                        callback();
                    }
                });
            }
            else
            {
                this.OnPlay(window, tag, parameters, root, forward, callback);
            }
        }
        private RectTransform GetRoot(Parameters parameters, WindowComponentBase root)
        {
            WindowComponent component = null;

            if (root is LinkerComponent && !component)
            {
                component = (root as LinkerComponent).Get <WindowComponent>();
            }

            if (root is WindowLayoutBase && !component)
            {
                component = (root as WindowLayoutBase).GetCurrentComponent();
            }

            if (root is WindowComponent && !component)
            {
                component = root as WindowComponent;
            }

            if (component == null && parameters == null)
            {
                return(null);
            }
            if (component == null || parameters.moveRoot == true)
            {
                return(root.transform as RectTransform);
            }
            if (parameters == null)
            {
                return(component.transform as RectTransform);
            }

            return(component.transform as RectTransform);
        }
예제 #4
0
            public void ApplyInputParameters(WindowComponentBase layoutElement)
            {
                var component = layoutElement.gameObject.AddComponent(System.Type.GetType("UnityEngine.UI.Windows.Animations." + this.transition.GetType().Name + "Parameters")) as TransitionInputParameters;

                component.SetDefaultParameters(this.GetDefaultInputParameters());
                layoutElement.animationInputParams.Add(component);
            }
		public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback) {

			var param = this.GetParams<Parameters>(parameters);
			if (param == null || root == null) {

				if (callback != null) callback();
				return;

			}

			var duration = this.GetDuration(parameters, forward);
			var result = param.GetResult(forward);

			if (TweenerGlobal.instance != null) {

				//TweenerGlobal.instance.removeTweens(tag);
				TweenerGlobal.instance.addTweenAlpha(root.canvas, duration, result).ease(ME.Ease.GetByType(forward == true ? param.inEase : param.outEase)).onComplete((obj) => { if (callback != null) callback(); }).onCancel((obj) => { if (callback != null) callback(); }).tag(tag);

			} else {

				if (root.canvas != null) root.canvas.alpha = result;
				if (callback != null) callback();

			}

		}
		private RectTransform GetRoot(Parameters parameters, WindowComponentBase root) {

			if (parameters != null && parameters.root != null) return parameters.root;

			WindowComponent component = null;
			if (root is LinkerComponent && !component) {

				component = (root as LinkerComponent).Get<WindowComponent>();
				
			}
			
			if (root is WindowLayoutBase && !component) {
				
				component = (root as WindowLayoutBase).GetCurrentComponent();
				
			}

			if (root is WindowComponent && !component) {
				
				component = root as WindowComponent;
				
			}

			if (component == null && parameters == null) return null;
			if (component == null || parameters.moveRoot == true) return root.transform as RectTransform;
			if (parameters == null) return component.transform as RectTransform;

			return component.transform as RectTransform;

		}
        public void Play(List <TransitionInputParameters> parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            Transition callbacker  = null;
            var        maxDuration = 0f;
            var        i           = 0;

            foreach (var transition in this.transitions)
            {
                var d = transition.GetDuration(parameters[i++], forward);
                if (d >= maxDuration)
                {
                    maxDuration = d;
                    callbacker  = transition;
                }
            }

            i = 0;
            foreach (var transition in this.transitions)
            {
                transition.Play(parameters[i++], root, forward, callbacker == transition ? callback : null);
            }

            if (callbacker == null && callback != null)
            {
                callback();
            }
        }
예제 #8
0
 public void ApplyInputParameters(WindowComponentBase layoutElement)
 {
     layoutElement.animationInputParams.Clear();
     foreach (var transition in this.transitions)
     {
         transition.ApplyInputParameters(layoutElement);
     }
 }
        public void SetResetState(List <TransitionInputParameters> parameters, WindowComponentBase root)
        {
            var i = 0;

            foreach (var transition in this.transitions)
            {
                transition.SetResetState(parameters[i++], root);
            }
        }
예제 #10
0
        public virtual void SetResetState(TransitionInputParameters parameters, WindowComponentBase root)
        {
            var tag = this.GetInstanceID().ToString() + (root != null ? ("_" + root.GetInstanceID().ToString()) : string.Empty);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }
        }
		public void SetOutState(List<TransitionInputParameters> parameters, WindowBase window, WindowComponentBase root) {
			
			var i = 0;
			foreach (var transition in this.transitions) {
				
				transition.SetOutState(parameters[i++], window, root);
				
			}

		}
		public void ApplyInputParameters(WindowComponentBase layoutElement) {

			layoutElement.animationInputParams.Clear();
			foreach (var transition in this.transitions) {

				transition.ApplyInputParameters(layoutElement);

			}

		}
            public void ApplyInputParameters(WindowComponentBase layoutElement)
            {
                var component = layoutElement.gameObject.AddComponent(System.Type.GetType(string.Format("UnityEngine.UI.Windows.Animations.{0}Parameters", this.transition.GetType().Name))) as TransitionInputParameters;

                component.SetDefaultParameters(this.GetDefaultInputParameters());
                layoutElement.animationInputParams.Add(component);
                                #if UNITY_EDITOR
                component.OnValidate();
                                #endif
            }
    public override void SetResetState(TransitionInputParameters parameters, WindowComponentBase root)
    {
        var param = this.GetParams <Parameters>(parameters);

        if (param == null)
        {
            return;
        }

        this.material.SetFloat("_Value", param.GetReset());
    }
        public override void SetResetState(TransitionInputParameters parameters, WindowComponentBase root)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            this.GetRoot(param, root).anchoredPosition = param.GetReset();
        }
예제 #16
0
        private RectTransform GetRoot(Parameters parameters, WindowComponentBase root)
        {
            if (parameters != null && parameters.root != null)
            {
                return(parameters.root);
            }

            WindowComponent component = null;

            if (root is LinkerComponent && component == null)
            {
                component = (root as LinkerComponent).Get <WindowComponent>();
            }

            if (root is WindowLayoutBase && component == null)
            {
                component = (root as WindowLayoutBase).GetCurrentComponent();
            }

            if (root is WindowComponent && component == null)
            {
                component = root as WindowComponent;
            }

            if (component == null && parameters == null)
            {
                return(null);
            }
            if (component != null && parameters == null)
            {
                return(component.transform as RectTransform);
            }
            if (component == null || (parameters != null && parameters.moveRoot == true))
            {
                if (root == null)
                {
                    if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                    {
                        UnityEngine.Debug.LogWarning(string.Format("Root is null, GetRoot() returns {0}, {1}.", root, component));
                    }
                    return(null);
                }

                return(root.transform as RectTransform);
            }

            return(component.transform as RectTransform);
        }
        public override void SetResetState(TransitionInputParameters parameters, WindowComponentBase root)
        {
            base.SetResetState(parameters, root);

            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            if (root != null && root.canvas != null)
            {
                root.canvas.alpha = param.GetReset();
            }
        }
		public void SetInState(List<TransitionInputParameters> parameters, WindowBase window, WindowComponentBase root) {
			
			if (this.CheckMismatch(window, parameters) == false) {

				return;
				
			}

			var i = 0;
			foreach (var transition in this.transitions) {
				
				transition.SetInState(parameters[i++], window, root);
				
			}

		}
			public Rect GetComponentRect(LayoutWindowType screen, WindowComponentBase component) {

				//var rect = (component.transform as RectTransform).rect;
				
				var corners = new Vector3[4];
				(component.transform as RectTransform).GetWorldCorners(corners);
				
				var leftBottom = this.GetScreenPoint(screen, component, corners[0]);
				var topRight = this.GetScreenPoint(screen, component, corners[2]);

				var rect = new Rect();
				rect.x = leftBottom.x;
				rect.y = leftBottom.y;
				rect.width = topRight.x - leftBottom.x;
				rect.height = topRight.y - leftBottom.y;

				return rect;

			}
예제 #20
0
        public void Play(ME.Tweener.MultiTag tag, WindowAnimationBase transitionBase, WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var delay = this.GetDelay(parameters, forward);

            if (delay > 0f && TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => {
                    this.OnPlay(window, tag, parameters, root, forward, callback);
                }).onCancel((obj) => {
                    if (callback != null)
                    {
                        callback.Invoke();
                    }
                });
            }
            else
            {
                this.OnPlay(window, tag, parameters, root, forward, callback);
            }
        }
 public void SetInState(TransitionInputParameters parameters, WindowComponentBase root)
 {
     this.transition.SetInState(parameters, root);
 }
예제 #22
0
 public void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
 {
     this.transition.SetResetState(parameters, window, root);
 }
예제 #23
0
        public void SetOutState(List <TransitionInputParameters> parameters, WindowBase window, WindowComponentBase root)
        {
            if (this.CheckMismatch(window, parameters) == false)
            {
                return;
            }

            var i = 0;

            foreach (var transition in this.transitions)
            {
                transition.SetOutState(parameters[i++], window, root);
            }
        }
예제 #24
0
        public override void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            param.Apply(this.GetRoot(param, root), param.GetReset());
        }
        public override void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            //var duration = this.GetDuration(parameters, forward);
            var rect = this.GetRoot(param, window);

            var state       = new Parameters.State(rect);
            var resultState = param.GetResult(forward);

            var material = param.GetMaterialInstance();

            param.Apply(material, rect, state, resultState, ME.Ease.GetByType(forward == true ? param.inEase : param.outEase).interpolate(0f, 1f, value, 1f));
        }
        public void Play(WindowBase window, List <TransitionInputParameters> parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            if (this.CheckMismatch(window, parameters) == false)
            {
                if (callback != null)
                {
                    callback.Invoke();
                }
                return;
            }

            Transition callbacker  = null;
            var        maxDuration = 0f;

            for (int i = 0; i < this.transitions.Count; ++i)
            {
                var transition = this.transitions[i];
                var d          = transition.GetDuration(parameters[i], forward);

                if (d >= maxDuration)
                {
                    maxDuration = d;
                    callbacker  = transition;
                }
            }

            var tag = root.GetCustomTag(this);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }

            for (int i = 0; i < this.transitions.Count; ++i)
            {
                var transition = this.transitions[i];
                transition.Play(tag, this, window, parameters[i], root, forward, callbacker == transition ? callback : null);
            }

            if (callbacker == null && callback != null)
            {
                callback.Invoke();
            }
        }
        public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            this.currentWindow = window;

            this.prevWindow = WindowSystem.GetPreviousWindow(window, (item) => item.window != null && item.window.GetState() == WindowObjectState.Shown);
            if (this.prevWindow == null)
            {
                window.transition.SaveToCache(this.clearScreen, () => {
                    this.material.SetTexture("_ClearScreen", this.clearScreen);
                }, this.grabEveryFrame);
            }
            else
            {
                if (forward == true)
                {
                    // Take screenshot from current view
                    this.prevWindow.transition.SaveToCache(this.clearScreen, () => {
                        this.material.SetTexture("_ClearScreen", this.clearScreen);
                    }, this.grabEveryFrame);
                }
                else
                {
                    // Take screenshot from previous view
                    this.prevWindow.transition.SaveToCache(this.clearScreen, () => {
                        this.material.SetTexture("_ClearScreen", this.clearScreen);
                    }, this.grabEveryFrame);
                }
            }

            var duration = this.GetDuration(parameters, forward);
            var result   = param.GetResult(forward);

            TweenerGlobal.instance.removeTweens(tag);
            TweenerGlobal.instance.addTween(this, duration, this.material.GetFloat("_Value"), result).onUpdate((obj, value) => {
                this.material.SetFloat("_Value", value);
            }).onComplete((obj) => { if (callback != null)
                                     {
                                         callback();
                                     }
                          }).onCancel((obj) => { if (callback != null)
                                                 {
                                                     callback();
                                                 }
                                      }).tag(tag);
        }
		public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback) {

			var param = this.GetParams<Parameters>(parameters);
			if (param == null) {

				if (callback != null) callback();
				return;

			}

			var duration = this.GetDuration(parameters, forward);
			var resultState = param.GetResult(forward);

			var rect = this.GetRoot(param, window);
			var state = new Parameters.State(rect);

			var material = param.GetMaterialInstance();

			if (TweenerGlobal.instance != null) {

				//TweenerGlobal.instance.removeTweens(tag);
				TweenerGlobal.instance.addTween(rect, duration, 0f, 1f).onUpdate((obj, value) => {

					if (obj != null) {

						param.Apply(material, obj, state, resultState, value);

					}

				}).onComplete((obj) => {

					if (callback != null) callback();
					CanvasUpdater.ForceUpdate();

				}).onCancel((obj) => {

					if (callback != null) callback();
					CanvasUpdater.ForceUpdate();

				}).tag(tag).ease(ME.Ease.GetByType(forward == true ? param.inEase : param.outEase));

			} else {
				
				param.Apply(material, rect, resultState);
				if (callback != null) callback();
				CanvasUpdater.ForceUpdate();
				
			}

		}
		public override void SetResetState(TransitionInputParameters parameters, WindowComponentBase root) {
			
			var param = this.GetParams<Parameters>(parameters);
			if (param == null) return;

			this.GetRoot(param, root).anchoredPosition = param.GetReset();

		}
			public void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root) {

				this.transition.SetResetState(parameters, window, root);

			}
        public override void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            var source = this.GetRoot(param, window);

            var state       = new Parameters.State(source);
            var resultState = param.GetResult(forward);

            param.Apply(source, state, resultState, ME.Ease.GetByType(forward == true ? param.inEase : param.outEase).interpolate(0f, 1f, value, 1f));
        }
		public override void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value) {

			var param = this.GetParams<Parameters>(parameters);
			if (param == null) {

				return;
				
			}

			var source = this.GetRoot(param, window);

			var state = new Parameters.State(source);
			var resultState = param.GetResult(forward);

			param.Apply(source, state, resultState, ME.Ease.GetByType(forward == true ? param.inEase : param.outEase).interpolate(0f, 1f, value, 1f));

		}
예제 #33
0
 public virtual void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
 {
 }
 public void Play(ME.Tweener.MultiTag tag, WindowAnimationBase transitionBase, WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
 {
     this.transition.Play(tag, transitionBase, window, parameters, root, forward, callback);
 }
        public override void SetOutState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            param.Apply(param.GetMaterialInstance(), this.GetRoot(param, window), param.GetOut());
        }
        public void SetOutState(List <TransitionInputParameters> parameters, WindowBase window, WindowComponentBase root)
        {
            if (this.CheckMismatch(window, parameters) == false)
            {
                return;
            }

            var tag = root.GetCustomTag(this);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }

            var i = 0;

            foreach (var transition in this.transitions)
            {
                transition.SetOutState(parameters[i++], window, root);
            }
        }
예제 #37
0
        public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null || root == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            var duration    = this.GetDuration(parameters, forward);
            var resultState = param.GetResult(forward);

            var rect  = this.GetRoot(param, root);
            var state = new Parameters.State(rect);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
                TweenerGlobal.instance.addTween <RectTransform>(rect, duration, 0f, 1f).ease(ME.Ease.GetByType(forward == true ? param.inEase : param.outEase)).onUpdate((obj, value) => {
                    if (obj != null)
                    {
                        param.Apply(obj, state, resultState, value);
                    }
                }).onComplete((obj) => { if (callback != null)
                                         {
                                             callback();
                                         }
                              }).onCancel((obj) => { if (callback != null)
                                                     {
                                                         callback();
                                                     }
                                          }).tag(tag);
            }
            else
            {
                param.Apply(rect, resultState);
                if (callback != null)
                {
                    callback();
                }
            }
        }
			public void Play(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback) {

				this.transition.Play(window, parameters, root, forward, callback);
				
			}
		public override void SetOutState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root) {

			var param = this.GetParams<Parameters>(parameters);
			if (param == null) return;

			param.Apply(this.GetRoot(param, root), param.GetOut());

		}
		public void Play(WindowBase window, List<TransitionInputParameters> parameters, WindowComponentBase root, bool forward, System.Action callback) {

			if (this.CheckMismatch(window, parameters) == false) {

				callback();
				return;

			}

			Transition callbacker = null;
			var maxDuration = 0f;
			var i = 0;
			foreach (var transition in this.transitions) {

				var d = transition.GetDuration(parameters[i++], forward);
				if (d >= maxDuration) {

					maxDuration = d;
					callbacker = transition;

				}

			}

			i = 0;
			foreach (var transition in this.transitions) {

				transition.Play(window, parameters[i++], root, forward, callbacker == transition ? callback : null);

			}

			if (callbacker == null && callback != null) callback();

		}
예제 #41
0
 public void Play(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
 {
     this.transition.Play(window, parameters, root, forward, callback);
 }
예제 #42
0
        public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null || root == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            var duration = this.GetDuration(parameters, forward);
            var result   = param.GetResult(forward);

            if (TweenerGlobal.instance != null)
            {
                //TweenerGlobal.instance.removeTweens(tag);
                TweenerGlobal.instance.addTweenAlpha(root.canvas, duration, result).ease(ME.Ease.GetByType(forward == true ? param.inEase : param.outEase)).onComplete((obj) => { if (callback != null)
                                                                                                                                                                                  {
                                                                                                                                                                                      callback();
                                                                                                                                                                                  }
                                                                                                                                                                       }).onCancel((obj) => { if (callback != null)
                                                                                                                                                                                              {
                                                                                                                                                                                                  callback();
                                                                                                                                                                                              }
                                                                                                                                                                                   }).tag(tag);
            }
            else
            {
                if (root.canvas != null)
                {
                    root.canvas.alpha = result;
                }
                if (callback != null)
                {
                    callback();
                }
            }
        }
			public void SetInState(TransitionInputParameters parameters, WindowComponentBase root) {
				
				this.transition.SetInState(parameters, root);

			}
예제 #44
0
 public virtual void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value)
 {
 }
		public override void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root) {

			base.SetResetState(parameters, window, root);

			var param = this.GetParams<Parameters>(parameters);
			if (param == null) return;
			
			if (root != null && root.canvas != null) root.canvas.alpha = param.GetReset();
			
		}
예제 #46
0
        public virtual void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var tag = this.GetTag(window, parameters);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }
        }
		public override void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value) {

			var param = this.GetParams<Parameters>(parameters);
			if (param == null) {

				return;
				
			}
			
			//var duration = this.GetDuration(parameters, forward);
			var rect = this.GetRoot(param, window);

			var state = new Parameters.State(rect);
			var resultState = param.GetResult(forward);
			
			var material = param.GetMaterialInstance();

			param.Apply(material, rect, state, resultState, ME.Ease.GetByType(forward == true ? param.inEase : param.outEase).interpolate(0f, 1f, value, 1f));

		}
			private Vector3 GetScreenPoint(LayoutWindowType screen, WindowComponentBase component, Vector3 worldPoint) {
				
				return screen.workCamera.WorldToScreenPoint(worldPoint);
				
			}
		public override void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root) {
			
			var param = this.GetParams<Parameters>(parameters);
			if (param == null) return;

			param.Apply(param.GetMaterialInstance(), this.GetRoot(param, window), param.GetReset());

		}
		public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback) {

			var param = this.GetParams<Parameters>(parameters);
			if (param == null || root == null) {

				if (callback != null) callback();
				return;

			}

			var duration = this.GetDuration(parameters, forward);
			var result = param.GetResult(forward);

			var rect = this.GetRoot(param, root);
			var startPosition = rect.anchoredPosition;
			var endPosition = result;
			
			if (TweenerGlobal.instance != null) {

				TweenerGlobal.instance.removeTweens(tag);
				TweenerGlobal.instance.addTween<RectTransform>(rect, duration, 0f, 1f).onUpdate((obj, value) => {

					if (obj != null) {

						obj.anchoredPosition = Vector2.Lerp(startPosition, endPosition, value);

					}

				}).onComplete((obj) => { if (callback != null) callback(); }).onCancel((obj) => { if (callback != null) callback(); }).tag(tag);

			} else {
				
				rect.anchoredPosition = endPosition;
				if (callback != null) callback();
				
			}

		}