public void MoveTo(Ingredient ingredient, Transform t, TweenCallback callback) { //Should tween //ingredient.transform.position = t.position; ingredient.GetComponent<Rigidbody>().DOMove(t.position, 1f).OnComplete(callback); ingredient.GetComponent<Rigidbody>().velocity = Vector3.zero; }
/// <summary> /// Initializes a new instance of the <see cref="Tween"/> class. /// </summary> /// <param name='targetObj'> /// The objet to perform the Tween on. /// </param> /// <param name='propertyName'> /// Property name, eg. "X", "Y", "ScaleX", "Alpha", etc. /// </param> /// <param name='endVal'> /// The value to tween to. The tween will run from the property's value at start time to the end value. /// </param> /// <param name='duration'> /// Duration in seconds of the tween. /// </param> /// <param name='easingType'> /// Easing type. Any function matching the see cref="EaseValue"/> delegate. /// </param> /// <param name='delay'> /// Delay, in seconds. /// </param> /// <param name='startCallback'> /// Called when tween starts (after any delay). /// </param> /// <param name='endCallback'> /// Called when tween ends /// </param> /// <exception cref='Exception'> /// Thrown when a Tween is created before Stage /// </exception> /// <exception cref='ArgumentException'> /// Thrown when targetObj param is null or targetObj does not have property referenced by propertyName arg. /// </exception> public Tween(DisplayObjectContainer targetObj, string propertyName, float endVal, float duration, EaseValue easingType, float delay = 0f, TweenCallback startCallback = null, TweenCallback endCallback = null) { if (TweenRunner.Instance == null) throw new Exception("TweenRunner must be added to Stage before creating Tweens"); if (targetObj == null) throw new ArgumentException("targetObj is null"); Id = Guid.NewGuid(); TargetObj = targetObj; if (!String.IsNullOrEmpty(propertyName)) { Property = targetObj.GetType().GetProperty(propertyName); if (Property == null) throw new ArgumentException("targetObj does not have property named " + propertyName); } //StartVal gets set when tween actually starts running, since the value may change during a delay EndVal = endVal; StartTime = TweenRunner.Instance.__GetCurrentTime(); Duration = duration; EasingType = easingType; Delay = delay; StartCallback = startCallback; EndCallback = endCallback; if (!String.IsNullOrEmpty(propertyName)) TweenRunner.Instance.__AddTween(this); }
public virtual void FadeOut(float duration, TweenCallback onComplete=null) { if (isTransitionComplete == false) return; isTransitionComplete = false; Sequence tween = DOTween.Sequence (); tween.Append (canvasGroup.DOFade (0.0f, duration).OnComplete (OnCompleteTransition)); if (onComplete != null) tween.OnComplete (onComplete); tween.Play (); }
public static IEnumerator tween_cr(Type easeType, float start, float end, float time, TweenCallback callback) { float t = 0; while (t < time) { float val = Ease(easeType, start, end, t / time); if (callback != null) { callback(val); } t += Time.deltaTime; yield return null; } if (callback != null) { callback(end); } }
public static TweenFunc Create(TweenType tweenType, double startValue, double endValue, double duration, TweenCallback finished = null) { var time = 0.0; var called = false; return overrideTimer => { var t = overrideTimer != null ? overrideTimer.Value : (time = Math.Min(time + GameOptions.Timestep, duration)); if (t >= duration && !called && finished != null) { called = true; finished(); } return (TweenMain(tweenType, t, duration) / (1 / (endValue - startValue))) + startValue; }; }
public static TweenFunc None(double value, double duration = 0, TweenCallback finished = null) { var time = 0.0; var called = false; return overrideTimer => { var t = overrideTimer != null ? overrideTimer.Value : (time = Math.Min(time + GameOptions.Timestep, duration)); if (t >= duration && !called && finished != null) { called = true; finished(); } return value; }; }
public static void TitleScreenExit(TweenCallback callback){ if (instance!=null){ GameManager.isAnimating = true; instance.bg.enabled = true; instance.bg.DOColor(new Color(0,0,0,0.7f),1.5f).OnComplete(()=>{ SFXManager.PlayOneShot(SFXManager.SFX.ping,1,0.5f); CharExit(); CameraEffect.Shake(0.5f); instance.bg.color = new Color(1,1,1,1); instance.bg.DOColor(new Color(0,0,0,0),0.5f).OnComplete(()=>instance.bg.enabled=false); }); instance.titleName.rectTransform.anchoredPosition = new Vector2(0,0); instance.titleName.rectTransform.localScale = new Vector3(1,1,1); DOTween.To(()=>instance.titleName.rectTransform.anchoredPosition, (Vector2 anchorPos)=>{instance.titleName.rectTransform.anchoredPosition = anchorPos;}, new Vector2(0,250),0.5f).SetDelay(1.5f).SetEase(Ease.OutBack).OnComplete(()=>GameManager.isAnimating=false); instance.titleName.rectTransform.DOScale(0.5f,0.5f).SetDelay(1.5f).SetEase(Ease.OutBack).OnComplete(callback) ; } }
public void Play(bool forward = true, TweenCallback onCompleteCallback = null, TweenCallback onRewindCallback = null) { if (!this.enabled) { // onCompleteCallback?.Invoke(); if (onCompleteCallback != null) { onCompleteCallback(); } return; } if (autoKill) { Initialize(); tweener.Pause(); } var newTweenParams = CommonTweenParams; if (onCompleteCallback != null) { newTweenParams.OnComplete(onCompleteCallback); } if (onRewindCallback != null) { newTweenParams.OnRewind(onRewindCallback); } tweener.SetAs(newTweenParams); if (forward) { ResetFrom(); tweener.PlayForward(); } else { tweener.PlayBackwards(); } isForward = forward; }
public GOTween(GameObject target, float duration, EaseFunction easeFunction = null, TweenCallback completeCallback = null, TweenCallback updateCallback = null) { if (easeFunction == null) { m_ease = EaseFunctions.LinearNone; } else { m_ease = easeFunction; } m_target = target; m_duration = duration; m_elapsed = 0.0f; m_completeCallback = completeCallback; m_updateCallback = updateCallback; }
/// <summary>Clears and resets this TweenParams instance using default values, /// so it can be reused without instantiating another one</summary> public TweenParams Clear() { id = target = null; updateType = DOTween.defaultUpdateType; isIndependentUpdate = DOTween.defaultTimeScaleIndependent; onStart = onPlay = onRewind = onUpdate = onStepComplete = onComplete = onKill = null; onWaypointChange = null; isRecyclable = DOTween.defaultRecyclable; isSpeedBased = false; autoKill = DOTween.defaultAutoKill; loops = 1; loopType = DOTween.defaultLoopType; delay = 0; isRelative = false; easeType = Ease.Unset; customEase = null; easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; easePeriod = DOTween.defaultEasePeriod; return this; }
public static void animVec2CallbackU(DOGetter <Vector2> getter, DOSetter <Vector2> setter, float duration, Vector2 animTo, TweenCallback onUpd, Ease easeType = Ease.Linear) { DOTween.To(getter, setter, animTo, duration).SetEase(easeType).SetUpdate(false).OnUpdate(onUpd); }
public static void PlayAnim(RectTransform target, Vector2 endValue, float duration, float scaleEndValue, TweenCallback action) { DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration) .SetOptions(false).SetTarget(target).SetEase <Tweener>(Ease.Linear); Vector3 endValueV3 = new Vector3(scaleEndValue, scaleEndValue, scaleEndValue); DOTween.To(() => target.localScale, x => target.localScale = x, endValueV3, duration).SetTarget(target) .SetEase <Tweener>(Ease.Linear).OnComplete <Tweener>(action); }
private static IEnumerator NextFixedFrameCoroutine(TweenCallback callback) { yield return(new WaitForFixedUpdate()); callback.Invoke(); }
public static void animPositionCallbacks(GameObject obj, float duration, Ease easeType, Vector3 animTo, TweenCallback onUpd, TweenCallback onComp, string tid) { DOTween.To(()=> obj.transform.localPosition, x=> obj.transform.localPosition = x, animTo, duration).SetEase(easeType).SetUpdate(false) .OnUpdate(onUpd).OnComplete(onComp).SetId(tid); }
public static Coroutine StartTween(MonoBehaviour parent, Type easeType, float start, float end, float time, TweenCallback callback) { return parent.StartCoroutine(tween_cr(easeType, start, end, time, callback)); }
public virtual void SlideOut(float duration, SlideTo to, TweenCallback onComplete=null) { if (isTransitionComplete == false) return; isTransitionComplete = false; rectTransform.localPosition = _defaultLocalPosition; Sequence tween = DOTween.Sequence (); switch (to) { case SlideTo.Up: tween.Append (rectTransform .DOLocalMoveY (_defaultLocalPosition.y + rectTransform.sizeDelta.y, duration) .OnComplete (OnCompleteTransition)); break; case SlideTo.Down: tween.Append (rectTransform .DOLocalMoveY (_defaultLocalPosition.y - rectTransform.sizeDelta.y, duration) .OnComplete (OnCompleteTransition)); break; case SlideTo.Left: tween.Append (rectTransform .DOLocalMoveX (_defaultLocalPosition.x - rectTransform.sizeDelta.x, duration) .OnComplete (OnCompleteTransition)); break; case SlideTo.Right: tween.Append (rectTransform .DOLocalMoveX (_defaultLocalPosition.x + rectTransform.sizeDelta.x, duration) .OnComplete (OnCompleteTransition)); break; default: Debug.LogErrorFormat ("{0} NotFoend {1}", typeof (SlideTo).Name, to); break; } if (onComplete != null) tween.OnComplete (onComplete); tween.Play (); }
/// <summary> /// 指定两张牌移动到两者之间的位置,放大,最后移动到屏幕游戏右下角,缩小 /// </summary> /// <param name="baseCard1">Base card1.</param> /// <param name="baseCard2">Base card2.</param> private void EffectMoveToMiddlePoint(BaseCard baseCard1, BaseCard baseCard2, Action action = null) { Debug.Log("移动到两点间的位置"); float moveTime = _cardConfig.CardMoveNormalTime; float middleMoveTime = _cardConfig.CardMoveToMiddleTime; Sequence sq; if (action == null) { sq = _cardMiddleSequence; if (sq != null) { sq.Complete(); sq.Kill(); sq = null; } } sq = DOTween.Sequence(); sq.PrependCallback(() => { _canPlayBack = false; /*InputControlManager.Instance.IsEnable = false;*/ }); GameObject obj1 = baseCard1.cardObj; GameObject obj2 = baseCard2.cardObj; Vector3 pos1 = obj1.transform.position; Vector3 pos2 = obj2.transform.position; Vector3 targetPosLeft = (pos1 + pos2) * 0.5f + Vector3.left * CARDS_HALFWIDTH; Vector3 targetPosRight = (pos1 + pos2) * 0.5f + Vector3.right * CARDS_HALFWIDTH; TweenCallback getMiddleFunc = () => { _smog.transform.position = (targetPosLeft + targetPosRight) * 0.5f; _smog.SetActive(true); LitTool.DelayPlayFunction(1f, () => { _smog.transform.position = Vector3.one * 999; _smog.SetActive(false); }); }; //移动到中心点 if (pos1.x <= pos2.x) { baseCard1.sprite.sortingOrder = 10000 - 1; baseCard2.sprite.sortingOrder = 10000 + 1; sq.Join(obj1.transform.DOMove(targetPosLeft + Vector3.left * _cardConfig.CardMoveOutRange, _cardConfig.CardMoveOutTime).SetEase(Ease.OutQuint)); sq.Join(obj2.transform.DOMove(targetPosRight + Vector3.right * _cardConfig.CardMoveOutRange, _cardConfig.CardMoveOutTime).SetEase(Ease.OutQuint)); sq.AppendInterval(_cardConfig.CardMoveOutTime); sq.Join(obj1.transform.DOMove(targetPosLeft, middleMoveTime).SetEase(_cardConfig.EaseType)); sq.Join(obj2.transform.DOMove(targetPosRight, middleMoveTime).SetEase(_cardConfig.EaseType).OnComplete(getMiddleFunc)); //reache call Back } else { baseCard1.sprite.sortingOrder = 10000 + 1; baseCard2.sprite.sortingOrder = 10000 - 1; sq.Join(obj1.transform.DOMove(targetPosRight + Vector3.right * _cardConfig.CardMoveOutRange, _cardConfig.CardMoveOutTime).SetEase(Ease.OutQuint)); sq.Join(obj2.transform.DOMove(targetPosLeft + Vector3.left * _cardConfig.CardMoveOutRange, _cardConfig.CardMoveOutTime).SetEase(Ease.OutQuint)); sq.AppendInterval(_cardConfig.CardMoveOutTime); sq.Join(obj1.transform.DOMove(targetPosRight, middleMoveTime).SetEase(_cardConfig.EaseType)); sq.Join(obj2.transform.DOMove(targetPosLeft, middleMoveTime).SetEase(_cardConfig.EaseType).OnComplete(getMiddleFunc)); //reache call Back } //_cardMiddleSequence.Join( obj1.transform.DOScale( Vector3.one * 1.1f, middleMoveTime * 0.5f ).SetEase( Ease.Linear ) ); //_cardMiddleSequence.Join( obj2.transform.DOScale( Vector3.one * 1.1f, middleMoveTime * 0.5f ).SetEase( Ease.Linear ) ); //中心点等待 sq.AppendInterval(_cardConfig.MiddleStayTime); sq.Join(baseCard2.sprite.material.DOFade(0f, moveTime)); sq.Join(baseCard1.sprite.material.DOFade(0f, moveTime)); sq.Join(obj1.transform.DOScale(Vector3.one * 0.5f, moveTime).SetEase(Ease.Linear)); sq.Join(obj2.transform.DOScale(Vector3.one * 0.5f, moveTime).SetEase(Ease.Linear)); //结束 sq.AppendCallback(() => { _canPlayBack = true; CheckCameraPos(); if (action != null) { action(); } sq.Kill(); /*baseCard1.cardObj.SetActive( false ); baseCard2.cardObj.SetActive( false );*/ }); }
public static Tweener ShowCenterToBig(Transform trans, TweenCallback callback) { trans.localScale = Vector3.zero; trans.gameObject.SetActive(true); return(trans.DOScale(Vector3.one, 1.5f).SetEase(Ease.InOutSine).SetAutoKill(false).OnComplete(callback)); }
public static Tweener TryAddUITween(this Transform trans, UIAnimationType mUIShowStyle, TweenCallback callback = null) { if (mUIShowStyle == UIAnimationType.CenterToBig) { return(CUITweener.ShowCenterToBig(trans, callback)); } else if (mUIShowStyle == UIAnimationType.FromDown || mUIShowStyle == UIAnimationType.FromLeft || mUIShowStyle == UIAnimationType.FromRight || mUIShowStyle == UIAnimationType.FromTop) { return(CUITweener.ShowFromDir(trans, mUIShowStyle, callback)); } else { return(null); } }
/// <summary> /// Starts the Close animation. (Coroutine inside TransitionManager) /// </summary> public void Close(TweenCallback callback = null) => AnimateTransition(false, callback);
/// <summary> /// Starts the Open animation /// </summary> public void Open(TweenCallback callback = null) => AnimateTransition(true, callback);
/// <summary> /// Perform movement of "wheel" of letters to find, and change the position to a "next one". /// </summary> /// <param name="_dropArea"></param> /// <param name="_position"></param> /// <param name="_callback"></param> void positionigAreaDropElement(DropSingleArea _dropArea, DropAreaPositions _position, TweenCallback _callback = null) { float durantion = 0.4f; Sequence _sequence = DOTween.Sequence(); bool needFade = false; if (_position == DropAreaPositions.CompletedPos) { needFade = true; } // - Actual elimination _dropArea.transform.DOLocalRotate(getRotation(_position), durantion); _sequence.Append(_dropArea.transform.DOLocalMove(getPosition(_position), durantion)).OnComplete(delegate() { if (needFade) { _sequence.Append(_dropArea.GetComponent <MeshRenderer>().materials[0].DOFade(0, durantion)); _sequence.Append(_dropArea.LetterLable.transform.DOLocalMove(new Vector3(getPosition(_position).x, -2, getPosition(_position).z), durantion)); // pro only // sequence.Append(Aree[actualAreaIndex].LetterLable.DOFade(0, 0.4f)); //if (_dropArea.DrawSprite) // _dropArea.DrawSprite.DOFade(0, 0.4f); if (_dropArea.DrawText) { _dropArea.DrawText.DOFade(0, 0.4f); } } if (_callback != null) { _callback(); } }); }
public static void PlayPunchAnimation(Transform obj, float animationTime, float punchSize, TweenCallback animationCompleteCallBack) { obj.DOKill(true); obj.DOPunchScale(new Vector3(punchSize, punchSize, 0f), animationTime, 2, 1f).OnComplete(animationCompleteCallBack); }
public static void animPositionCallbacks(GameObject obj, float duration, Ease easeType, Vector3 animTo, TweenCallback onUpd, TweenCallback onComp, string tid) { DOTween.To(() => obj.transform.localPosition, x => obj.transform.localPosition = x, animTo, duration).SetEase(easeType).SetUpdate(false) .OnUpdate(onUpd).OnComplete(onComp).SetId(tid); }
public static void TweenJump(GameObject go, Vector3 end, float power, int num, float time, Vector3 ro, TweenCallback cb) { Sequence tw = go.transform.DOLocalJump(end, 800, 1, time); tw.OnComplete(cb); go.transform.DOBlendableLocalRotateBy(ro, time); }
public static void animFloatCallbacks(DOGetter<float> getter, DOSetter<float> setter, float duration, float animTo, TweenCallback onUpd, TweenCallback onComp, Ease easeType = Ease.Linear) { DOTween.To(getter, setter, animTo, duration).SetEase(easeType).SetUpdate(false).OnUpdate(onUpd).OnComplete(onComp); }
TweenConfiguredSource() { onCompleteCallbackDelegate = OnCompleteCallbackDelegate; onUpdateDelegate = OnUpdate; }
public static void animVec2CallbackU(DOGetter<Vector2> getter, DOSetter<Vector2> setter, float duration, Vector2 animTo, TweenCallback onUpd, Ease easeType = Ease.Linear) { DOTween.To(getter, setter, animTo, duration).SetEase(easeType).SetUpdate(false).OnUpdate(onUpd); }
/// <summary> /// Tweens a virtual float. /// You can add regular settings to the generated tween, /// but do not use <code>SetUpdate</code> or you will overwrite the onVirtualUpdate parameter /// </summary> /// <param name="from">The value to start from</param> /// <param name="to">The value to tween to</param> /// <param name="duration">The duration of the tween</param> /// <param name="onVirtualUpdate">A callback which must accept a parameter of type float, called at each update</param> /// <returns></returns> public static Tweener Float(float from, float to, float duration, TweenCallback<float> onVirtualUpdate) { float val = from; return DOTween.To(() => val, x => val = x, to, duration).OnUpdate(() => onVirtualUpdate(val)); }
/// <summary>Sets the onStart callback for the tween. /// Called the first time the tween is set in a playing state, after any eventual delay</summary> public TweenParams OnStart(TweenCallback action) { this.onStart = action; return this; }
public void SetOnComplete(TweenCallback onComplete) { m_onComplete = onComplete; }
/// <summary>Sets the onPlay callback for the tween. /// Called when the tween is set in a playing state, after any eventual delay. /// Also called each time the tween resumes playing from a paused state</summary> public TweenParams OnPlay(TweenCallback action) { this.onPlay = action; return this; }
public void Fade(Sound _snd, float _volume, float _duration, TweenCallback _callback = null) { AudioSource src = GetSource(_snd); src.DOFade(_volume, _duration).OnComplete(_callback); }
/// <summary>Sets the onRewind callback for the tween. /// Called when the tween is rewinded, /// either by calling <code>Rewind</code> or by reaching the start position while playing backwards. /// Rewinding a tween that is already rewinded will not fire this callback</summary> public TweenParams OnRewind(TweenCallback action) { this.onRewind = action; return this; }
/// <summary> /// 销毁时的动画 /// 子类可以继承后修改他实现自己的动画效果 /// </summary> public virtual void AnimOnDestroy(TweenCallback callback = null) { //放大显示 transform.FadeOutUINode(0.5f, callback); }
/// <summary>Sets the onUpdate callback for the tween. /// Called each time the tween updates</summary> public TweenParams OnUpdate(TweenCallback action) { this.onUpdate = action; return this; }
public static void animFloatCallbacks(DOGetter <float> getter, DOSetter <float> setter, float duration, float animTo, TweenCallback onUpd, TweenCallback onComp, Ease easeType = Ease.Linear) { DOTween.To(getter, setter, animTo, duration).SetEase(easeType).SetUpdate(false).OnUpdate(onUpd).OnComplete(onComp); }
/// <summary>Sets the onComplete callback for the tween. /// Called the moment the tween reaches its final forward position, loops included</summary> public TweenParams OnComplete(TweenCallback action) { this.onComplete = action; return this; }
public static void animRotationCallbacks(GameObject obj, float duration, Ease easeType, Vector3 animTo, bool relative, TweenCallback onUpd, TweenCallback onComp) { obj.transform.DOLocalRotate(animTo, duration, RotateMode.FastBeyond360).SetEase(easeType).SetUpdate(false).SetRelative(relative) .OnUpdate(onUpd).OnComplete(onComp); }
/// <summary>Sets the onKill callback for the tween. /// Called the moment the tween is killed</summary> public TweenParams OnKill(TweenCallback action) { this.onKill = action; return this; }
public static void animScaleCallbackC(GameObject obj, float duration, Ease easeType, Vector3 animTo, TweenCallback onComp) { DOTween.To(() => obj.transform.localScale, x => obj.transform.localScale = x, animTo, duration).SetEase(easeType).SetUpdate(false) .OnComplete(onComp); }
/// <summary>Sets the onWaypointChange callback for the tween. /// Called when a path tween reaches a new waypoint</summary> public TweenParams OnWaypointChange(TweenCallback<int> action) { this.onWaypointChange = action; return this; }
public static void TweenBaitJump(GameObject go, Vector3 end, float power, int num, float time, TweenCallback cb) { Sequence tw = go.transform.DOLocalJump(end, power, 1, time); tw.OnComplete(cb); }
private void PauseGame() { Time.timeScale = 0; onOpenPausePanel -= PauseGame; }
//do float Tweener To(DOSetter<float> setter, float startValue, float endValue, float duration); public static Tweener doFloatTo(DG.Tweening.Core.DOSetter <float> call, float startValue, float endValue, float duration, TweenCallback finish = null) { Tweener tw = null; tw = DOTween.To(call, startValue, endValue, duration); if (finish != null) { tw.OnComplete(finish); } return(tw); }
private void OnDestroy() { onOpenPausePanel -= PauseGame; }
public virtual void SlideIn(float duration, SlideTo to, TweenCallback onComplete=null) { if (isTransitionComplete == false) return; isTransitionComplete = false; switch (to) { case SlideTo.Up: rectTransform.localPosition = _defaultLocalPosition + new Vector3 (0.0f, -rectTransform.sizeDelta.y); break; case SlideTo.Down: rectTransform.localPosition = _defaultLocalPosition + new Vector3 (0.0f, rectTransform.sizeDelta.y); break; case SlideTo.Left: rectTransform.localPosition = _defaultLocalPosition + new Vector3 (rectTransform.sizeDelta.x, 0.0f); break; case SlideTo.Right: rectTransform.localPosition = _defaultLocalPosition + new Vector3 (-rectTransform.sizeDelta.x, 0.0f); break; default: Debug.LogErrorFormat ("{0} NotFoend {1}", typeof (SlideTo).Name, to); break; } Sequence tween = DOTween.Sequence ().Append (rectTransform .DOLocalMoveX (0.0f, duration) .OnComplete (OnCompleteTransition)); if (onComplete != null) tween.OnComplete (onComplete); tween.Play (); }
public static T OnComplete <T>(this T t, TweenCallback action) where T : Tween => default;
/// <summary>Fires the given callback after the given time.</summary> /// <param name="delay">Callback delay</param> /// <param name="callback">Callback to fire when the delay has expired</param> /// <param name="ignoreTimeScale">If TRUE (default) ignores Unity's timeScale</param> public static Tween DelayedCall(float delay, TweenCallback callback, bool ignoreTimeScale = true) { return(DOTween.Sequence().AppendInterval(delay).OnStepComplete(callback).SetUpdate(UpdateType.Normal, ignoreTimeScale).SetAutoKill(true)); }
public static void animScaleCallbackC(GameObject obj, float duration, Ease easeType, Vector3 animTo, TweenCallback onComp) { DOTween.To(()=> obj.transform.localScale, x=> obj.transform.localScale = x, animTo, duration).SetEase(easeType).SetUpdate(false) .OnComplete(onComp); }
/// <summary>Fires the given callback after the given time.</summary> /// <param name="delay">Callback delay</param> /// <param name="callback">Callback to fire when the delay has expired</param> /// <param name="ignoreTimeScale">If TRUE (default) ignores Unity's timeScale</param> public static Tween DelayedCall(float delay, TweenCallback callback, bool ignoreTimeScale = true) { return DOTween.Sequence().AppendInterval(delay).OnComplete(callback).SetUpdate(UpdateType.Normal, ignoreTimeScale).SetAutoKill(true); }
protected override void InternalAlphaScreen(float timeToTween, float alpha, TweenCallback callback) { base.InternalAlphaScreen(timeToTween, Mathf.Clamp(alpha, 0.2f, 1f), callback); }
/// <summary> /// Tweens a virtual float. /// You can add regular settings to the generated tween, /// but do not use <code>SetUpdate</code> or you will overwrite the onVirtualUpdate parameter /// </summary> /// <param name="from">The value to start from</param> /// <param name="to">The value to tween to</param> /// <param name="duration">The duration of the tween</param> /// <param name="onVirtualUpdate">A callback which must accept a parameter of type float, called at each update</param> /// <returns></returns> public static Tweener Float(float from, float to, float duration, TweenCallback <float> onVirtualUpdate) { float val = from; return(DOTween.To(() => val, x => val = x, to, duration).OnUpdate(() => onVirtualUpdate(val))); }
private static IEnumerator NextFrameCoroutine(TweenCallback callback) { yield return(null); callback.Invoke(); }
public static void animFloatCallbackU(DOGetter<float> getter, DOSetter<float> setter, float duration, float animTo, TweenCallback onUpd) { DOTween.To(getter, setter, animTo, duration).SetUpdate(false).OnUpdate(onUpd); }
/// <summary> /// Call function in nexe fixed frame /// </summary> /// <param name="callback"></param> public static void NextFixedFrame(TweenCallback callback) { instance.StartCoroutine(NextFixedFrameCoroutine(callback)); }
public static void animRotationCallbackU(GameObject obj, float duration, Ease easeType, Vector3 animTo, bool relative, TweenCallback onUpd) { obj.transform.DOLocalRotate(animTo, duration, RotateMode.FastBeyond360).SetEase(easeType).SetUpdate(false).SetRelative(relative) .OnUpdate(onUpd); }
/// <summary> /// 移动到某个地方 /// </summary> /// <param name="pos">目标位置</param> /// <param name="isBack">是否返回原位</param> /// <param name="actComplete">移动结束回调</param> private void moveAct(Vector3 pos, bool isBack, TweenCallback actComplete = null) { this.isMoveBack = isBack; this.roleGo.transform.DOLocalMove(pos, this.atkMoveDuration).SetEase(Ease.Linear).OnComplete(actComplete); }
public SequenceCallback(float sequencedPosition, TweenCallback callback) { tweenType = TweenType.Callback; this.sequencedPosition = sequencedPosition; onStart = callback; }
/// <summary> /// Delayed call of delegate. /// </summary> /// <param name="callback">Callback to call.</param> /// <param name="delay">Delay in seconds.</param> public static TweenCase DelayedCall(float delay, TweenCallback callback, bool unscaledTime = false) { return(new TweenCaseDefault().SetTime(delay).SetUnscaledMode(unscaledTime).OnComplete(callback)); }