Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.34k stars 351 forks source link

SetDelay is appending interval between two tween Joined in sequence #683

Open MeetArgon opened 4 months ago

MeetArgon commented 4 months ago

I have issue where I loop through the list of transforms I want to scale them from 0 to their original scale with all tween start at same time but play after random delay but SetDelay is appending interval between two tween Joined in sequence. So all the transform tween are playing on after another.

public void AnimateBoard(Action callBack)
        {
            Sequence sq = DOTween.Sequence();
            int count = 0;
            for (int rank = 0; rank < 8; rank++)
            {
                for (int file = 0; file < 8; file++)
                {                 
                    Transform tr = squareRenderers[file, rank].transform;
                    Vector3 endScale = tr.localScale;
                    tr.localScale = Vector3.zero;
                    Tween tween = tr.DOScale(endScale, 0.2f).SetDelay(UnityEngine.Random.Range(0f, 0.5f));

                    sq.Join(tween);
                }
            }
            sq.Play().OnComplete(() =>
            {
                callBack?.Invoke();
            });
        }
Monsoonexe commented 2 months ago

Try sq.AppendInterval(...) after sq.Join to make the interval a part of the sequence and not part of the tween.

MeetArgon commented 2 months ago

@Monsoonexe I don't want tweens in sequence to play one after another I want them to play at same time but with their own individual delays.