public void TransitionIn() { _canvasGroup.transform.localScale = Vector3.one * 1.5f; _tweenAlpha.From = _canvasGroup.alpha; _tweenAlpha.To = 1f; _tweenAlpha.Play(); _tweenScale.From = _canvasGroup.transform.localScale; _tweenScale.To = Vector3.one; _tweenScale.Play(); }
public void Fade(FadeType fadeType, float duration) { _tweenAlpha.From = _canvasGroup.alpha; _tweenAlpha.To = fadeType == FadeType.In ? 1f : 0f; _tweenAlpha.Duration = duration; _tweenAlpha.Play(); }
/// <summary> /// 设置抛物线(贝塞尔曲线) /// </summary> public void SetCurve(Vector3 end, float time, float hight) { if (m_object != null) { TweenCurve cur = TweenCurve.Get(m_object); cur.duration = time * 0.001f; cur.from = GetPos(); cur.front = new Vector3(0, hight, 0); cur.back = new Vector3(0, hight, 0); cur.to = end; cur.method = UITweener.Method.Linear; cur.Reset(); cur.Play(true); TweenFloat rota = TweenFloat.Get(m_object); rota.duration = time * 0.001f; rota.from = 0; rota.to = -360; rota.method = UITweener.Method.EaseOut; rota.Reset(); rota.Play(true); rota.FloatUpdateEvent = (val) => { SetDirection(val * Vector3.one); }; } }
protected override void OnPlay() { base.OnPlay(); _tweenFloat.From = _canvasGroup.alpha; _tweenFloat.To = _fadeType == FadeType.In ? 1f : 0f; _tweenFloat.Play(); }
protected override void OnPlay() { base.OnPlay(); if (_tweener != null) { Destroy(_tweener); } _tweener = gameObject.AddComponent <TweenFloat>(); _tweener.From = 0f; _tweener.To = 1f; _tweener.OnDone += OnTweenDone; _tweener.Duration = Duration; _tweener.Play(); }
public void Transition(MenuBase from, MenuBase to, Action <MenuBase> onComplete) { _out = from; _in = to; _in.SetVisibility(true); _outCanvas = from.gameObject.GetOrAddComponent <CanvasGroup>(); _inCanvas = to.gameObject.GetOrAddComponent <CanvasGroup>(); _onComplete = onComplete; _tweenAlphaIn.Duration = TransitionTime; _tweenAlphaOut.Duration = TransitionTime; _tweenAlphaIn.Play(); _tweenAlphaOut.Play(); _transitioning = true; }