DoTween

  1. 按时间循环
//按时间循环 1
public void DOTweenToTest(float delayedTimer, int loopTimes,TweenCallback callBack)
    {
        float timer = 0;
        Tween t = DOTween.To(() => timer, x => timer = x, 1, delayedTimer)
            .OnStepComplete(callBack)
            .SetLoops(loopTimes);
    }
//2
    private Tween refreshTween;
    private void DOTweenToTest(float delayedTimer, int loopTimes, TweenCallback callBack)
    {
        float timer = 0;
        if (refreshTween != null) {
            refreshTween.Kill();
            refreshTween = null;
        }
        refreshTween = DOTween.To(() => timer, x => timer = x, 1, delayedTimer)
            .OnStepComplete(callBack)
            .SetLoops(loopTimes);
    }

你可能感兴趣的:(DoTween)