//parameters: float width, float duration, MMTweeningEaseEnum ease protected override void StartTransition(bool isActivate, object[] parameters) { if (_activeTween != null) { UIVirtualValueTweenController.Instance.StopTweener(_activeTween); _activeTween = null; } _isActive = isActivate; if (!_isActive) { HideContent(); } float width = (float)parameters[0]; float duration = (float)parameters[1]; UITweeningEaseEnum ease = (UITweeningEaseEnum)parameters[2]; UIVirtualValueTweenerInfo tweenInfo = new UIVirtualValueTweenerInfo() { Duration = duration, Ease = ease, From = RectTransform.sizeDelta.x, IgnoreTimeScale = true, To = GetNewVertSize(width), Callback = OnTweenUpdated }; UIVirtualValueTweener newTween = new UIVirtualValueTweener(tweenInfo); UIVirtualValueTweenController.Instance.StartTweener(newTween); }
//(For instant trans.)parameters: CarouselTransitionEnum transition, float to //(For float trans.)parameters: CarouselTransitionEnum transition, float duration, MMTweeningEaseEnum ease, float to, Vector2 pivot protected override void StartTransition(bool isActivate, object[] parameters) { _isActive = isActivate; if (!_isActive) { HideContent(); } CarouselTransitionEnum transition = (CarouselTransitionEnum)parameters[0]; if (transition == CarouselTransitionEnum.Instant) { RectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, GetNewVertSize((float)parameters[1])); if (_isActive) { ShowContent(); } } else if (transition == CarouselTransitionEnum.Float) { float duration = (float)parameters[1]; UITweeningEaseEnum ease = (UITweeningEaseEnum)parameters[2]; float to = (float)parameters[3]; Vector2 pivot = (Vector2)parameters[4]; StartFloatTransition(duration, ease, to, pivot); } }
public void SetEase(UITweeningEaseEnum easeType) { if ((/*easeType == UITweeningEaseEnum.Punch || */ easeType == UITweeningEaseEnum.Shake) && (GetType() == typeof(UITweenColor) || GetType() == typeof(UITweenAlpha))) { return; } Ease = easeType; SetDuration(Duration); }
private void StartFloatTransition(float duration, UITweeningEaseEnum ease, float to, Vector2 pivot) { if (_activeTween != null) { UIVirtualValueTweenController.Instance.StopTweener(_activeTween); _activeTween = null; } RectTransform.SetPivotWithCounterAdjustPosition(pivot, InitialSize); UIVirtualValueTweenerInfo newTweenInfo = new UIVirtualValueTweenerInfo() { Callback = OnFloatTweenUpdated, Duration = duration, Ease = ease, IgnoreTimeScale = true, From = RectTransform.sizeDelta.y, To = GetNewVertSize(to) }; _activeTween = new UIVirtualValueTweener(newTweenInfo); UIVirtualValueTweenController.Instance.StartTweener(_activeTween); }
public static float GetSample(float curDuration, float duration, UITweeningEaseEnum ease, AnimationCurve animationCurve = null) { float curClampedValue = 0f; switch (ease) { case UITweeningEaseEnum.Shake: curClampedValue = AnimationCurve(animationCurve, curDuration, duration); break; //case UITweeningEaseEnum.Punch: // curClampedValue = AnimationCurve(PunchAnimationCurve, curDuration, duration); // break; case UITweeningEaseEnum.Curve: curClampedValue = AnimationCurve(animationCurve, curDuration, duration); break; case UITweeningEaseEnum.Linear: curClampedValue = Linear(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InCubic: curClampedValue = EaseInCubic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutCubic: curClampedValue = EaseOutCubic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutCubic: curClampedValue = EaseInOutCubic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InSine: curClampedValue = EaseInSine(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutSine: curClampedValue = EaseOutSine(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutSine: curClampedValue = EaseInOutSine(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InExpo: curClampedValue = EaseInExpo(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutExpo: curClampedValue = EaseOutExpo(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutExpo: curClampedValue = EaseInOutExpo(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InBack: curClampedValue = EaseInBack(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutBack: curClampedValue = EaseOutBack(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutBack: curClampedValue = EaseInOutBack(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InQuintic: curClampedValue = EaseInQuint(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutQuintic: curClampedValue = EaseOutQuint(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutQuintic: curClampedValue = EaseInOutQuint(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InQuartic: curClampedValue = EaseInQuartic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutQuartic: curClampedValue = EaseOutQuartic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutQuartic: curClampedValue = EaseInOutQuartic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InQuadratic: curClampedValue = EaseInQuadratic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutQuadratic: curClampedValue = EaseOutQuadratic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutQuadratic: curClampedValue = EaseInOutQuadratic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InCircular: curClampedValue = EaseInCircular(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutCircular: curClampedValue = EaseOutCircular(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutCircular: curClampedValue = EaseInOutCircular(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InElastic: curClampedValue = EaseInElastic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutElastic: curClampedValue = EaseOutElastic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutElastic: curClampedValue = EaseInOutElastic(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InBounce: curClampedValue = EaseInBounce(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.OutBounce: curClampedValue = EaseOutBounce(0f, 1f, curDuration, duration); break; case UITweeningEaseEnum.InOutBounce: curClampedValue = EaseInOutBounce(0f, 1f, curDuration, duration); break; } return(curClampedValue); }