# TweenSequence Play a sequence of tweens, waits, parallel tween groups, and callbacks with support for pausing and resuming mid-sequence. ## Types ### `TweenSequenceType` ``` { number | Tween | {Tween} | () -> () } ``` A sequence is an ordered array of items. Each item is processed one at a time (except parallel groups), in the order it appears. Supported item types: | Type | Behaviour | | ------------- | ----------------------------------------------------------------------------------------------- | | `number` | Waits for that many seconds before advancing. | | `Tween` | Plays the tween and waits for it to complete before advancing. | | `{Tween}` | Plays all tweens in parallel. Waits for the longest one to complete before advancing. | | `() -> ()` | Calls the function immediately and advances. No waiting. | --- ## Constructor ### `Create` `Create(sequence: TweenSequenceType)` → `TweenSequence` Creates a new `TweenSequence` from the provided sequence. Does not begin playback automatically. #### Parameters | Name | Type | Required | | -------- | -------------------- | -------- | | sequence | `TweenSequenceType` | Yes | #### Returns | Type | | --------------- | | `TweenSequence` | #### Example ```lua local seq = TweenSequence.Create({ tweenA, -- plays tweenA, waits for completion 1.5, -- waits 1.5 seconds { tweenB, tweenC }, -- plays tweenB and tweenC in parallel, waits for longest function() print("done!") end, }) seq:Play() ``` --- ## Properties ### `Playing` `Playing: boolean` `true` while the sequence is actively running. Set to `false` when the sequence completes or is paused. --- ## Methods ### `Play` `Play()` → `void` Plays the sequence from the beginning. Each item in the sequence is processed in order. --- ### `Pause` `Pause()` → `void` Pauses the sequence at the current step. Any actively playing `Tween` instances at that step are also paused. The elapsed time within the current step is retained for use by [`Resume`](#resume). --- ### `Resume` `Resume()` → `void` Resumes the sequence from where it was paused. Completes the remaining duration of the current step (accounting for elapsed time) before advancing to subsequent steps. Does nothing if the sequence is already playing or has not been started.