dotween icon indicating copy to clipboard operation
dotween copied to clipboard

Feature Request: Delay Between Endless Yoyo Loops

Open Dentrax opened this issue 7 years ago • 12 comments

We can give a delay via SetDelay() before tween starts. If tween starts as Yoyo with -1 loops, we can't give a delay between loop starts and ends.

For example; -We have a Block that move 0 to 5 endless with Yoyo -1. -When we use SetDelayYoyo(5); when the Block reached the 0 to 5 first time, it should be waits 5 sec, and than, returns again to 0 and waits 5 sec again, this will continue similarly...

Thanks...

@Demigiant

Dentrax avatar Feb 28 '18 09:02 Dentrax

mySequence = DOTween.Sequence(); mySequence.Append(this.transform.DOMoveY(MoveDistance, DownDoneTime).SetRelative().SetDelay(StartWaitTime).SetEase(Ease.Linear)) .Append( this.transform.DOMoveY(startPosY, UpDoneTime).SetDelay(UpWaitTime).SetEase(Ease.Linear)) .SetDelay(TestValue); ; mySequence.SetLoops(-1, LoopType.Restart); create Sequence You can set the delay separately

XiaoFanJX avatar Aug 16 '18 06:08 XiaoFanJX

Hi, I've been trying your beautiful code to adjust the delay between color loop, but with no results... any chance you can write that piece of art to work on color loops? or better yet - can you make some global adjustment to set a delay between any time of a loop?

Thanks.

Ariel-Feldman avatar Apr 02 '19 13:04 Ariel-Feldman

I confirm that we need this feature. It's inconvenient to setup delays through the Sequence.

subzero911 avatar Aug 05 '19 08:08 subzero911

But delays is one of the reasons Sequences exist :B I chose to leave a Tweener's delay as a one-off because that's the most frequent use-case, and imo it makes sense that if you want to create a whole tween that includes repeating delays you use a Sequence instead.

Demigiant avatar Aug 06 '19 00:08 Demigiant

Hey Demigiant, I still would love to have another function for the Tweener called SetLoopDelay or SetLoopInterval, or even an extra optional parameter on SetLoops. I only have one tween, and I would like to avoid using Sequences for that simple case.

cAyou avatar Aug 06 '19 13:08 cAyou

Have you tried prependInterval(float)? Your sequence will wait 5 seconds at start every time it loops.

        Sequence mySequence = DOTween.Sequence().SetLoops(-1);

        mySequence.PrependInterval(5);

AlbertMontagutCasero avatar Jan 05 '20 01:01 AlbertMontagutCasero

But delays is one of the reasons Sequences exist :B I chose to leave a Tweener's delay as a one-off because that's the most frequent use-case, and imo it makes sense that if you want to create a whole tween that includes repeating delays you use a Sequence instead.

I have an infinite looping sequence. The tween has a delay, but it happens on every time the sequence loops. I'd like to have this delay run only once, just not able to (tried tweaking, no success). Can you confirm that this is still how it works (tween delay inside sequence = one-ff)? Because I am seeing different results.

kreso22 avatar Jan 13 '20 19:01 kreso22

When you add a delay to a Sequence it is treated as an InsertInterval(0, delay), so it repeats always, yes. One-off delays are only for Tweeners.

If you want to start anything after a one-off delay consider that you can use DOVirtual.DelayedCall.

Demigiant avatar Jan 13 '20 19:01 Demigiant

Ah! Thanks for the prompt response. I built this level editor with a system. Using dotween I can do anything (I'm in awe of the power and extensibility). But using DoVirtual will throw me outside using tweens and sequences.

Currently in my game if a player dies, whole level rewinds (all sequences rewind basically ), its pretty cool. It would be very complicated to chain DOVirtual because it is not sensitive to Sequence's (or Tween's) Rewind, Pause, Timescale etc...

Would there be a way to prependInterval to a sequence, and then destroy/remove the interval after first loop? I could prepend it again when player dies (when I rewind the sequence).

:)

kreso22 avatar Jan 13 '20 19:01 kreso22

I just started using this tool so not sure if this is correct way, but this creates pause before loops, the AppendInterval function, and SetDelay to create pause on start of each sequence

Sequence s = DOTween.Sequence(); s.SetDelay(1f); s.Append(cube.DOLocalRotate(rotacija, duration).SetRelative().SetEase(ease)); s.AppendInterval(1f); s.SetLoops(-1, LoopType.Yoyo);

DjoleDzele avatar Nov 25 '20 17:11 DjoleDzele

I know it's old but maybe it will help someone else.

.SetDelay(startDelay, false);

You can use SetDelay with second parameter now :)

Docs description: [SetDelay(float delay, bool asPrependedIntervalIfSequence)] Sets a delayed startup for the tween with options to choose how the delay is applied in case of Sequences. Has no effect if the tween has already started. asPrependedIntervalIfSequence Only used by Sequences: If FALSE sets the delay as a one-time occurrence (defaults to this for Tweeners), otherwise as a Sequence interval which will repeat at the beginning of every loop cycle.

SkylinR avatar Oct 04 '22 20:10 SkylinR

@SkylinR Thanks, a lot!! it really helped me and you saved my day :)

yashaswi avatar Aug 03 '24 15:08 yashaswi