Miliastra Wonderland Lua API

TweenSequence

The type that represents an instance of a Tween Sequence which can be used to play multiple Tweens in sequence or parallel. Contains functions for adding Tweens, delays, and callbacks to the Tween Sequence in a timeline-like style.

Tweens in the sequence can target different Client Controls.

Tween Sequence Playback States:

  • Initial
  • Playing
  • Paused
  • Completed

Regular Tween behaviors apply.

Methods15

function TweenSequence:Append(tween: Tween) -> ts TweenSequence

Appends a Tween to the end of the sequence and returns the current instance.

  • Tweens can only be appended if the Tween Sequence is in the Initial state.
  • If the added Tween is not in the Initial state, the Tween will not play its animation or call callbacks during the sequence.
  • Added Tweens should be in the Initial state and are considered to be in the Locked state after being added.
Parameters
tweenTween

The Tween to append to the sequence.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:AppendCallback(callback: fun() -> nil) -> ts TweenSequence

Appends a callback to the end of the sequence and returns the current instance.

  • Callbacks can only be appended if the Tween Sequence is in the Initial state.
Parameters
callbackfun() -> nil

The function to call.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:AppendInterval(duration: number) -> ts TweenSequence

Appends a delay (in seconds) to the end of the sequence and returns the current instance.

  • Delays can only be appended if the Tween Sequence is in the Initial state.
Parameters
durationnumber

The wait duration in seconds.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:Complete()

Immediately completes Tween Sequence playback, moving the Tween Sequence to the Completed state.

  • The OnStepComplete and OnComplete callbacks of the Tween Sequence and all Tweens will be called.
function TweenSequence:Insert(time: number, tween: Tween) -> ts TweenSequence

Inserts a Tween at a specific time and returns the current instance.

  • Tweens can only be inserted if the Tween Sequence is in the Initial state.
Parameters
timenumber

The time at which to insert the Tween.

tweenTween

The Tween to insert.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:InsertCallback(time: number, callback: fun() -> nil) -> ts TweenSequence

Inserts a callback at a specific time and returns the current instance.

  • Callbacks can only be inserted if the Tween Sequence is in the Initial state.
Parameters
timenumber

The time at which to insert the callback.

callbackfun() -> nil

The function to call.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:Join(tween: Tween) -> ts TweenSequence

Inserts a Tween at the same time as the current tailing Tween in the sequence and returns the current instance.

  • Tweens can only be joined if the Tween Sequence is in the Initial state.
Parameters
tweenTween

The Tween to insert.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:Kill(complete: boolean)

Destroys the Tween Sequence.

Parameters
completeboolean

Whether to immediately complete Tween Sequence playback and call the OnStepComplete and OnComplete callbacks of the Tween Sequence and all Tweens.

function TweenSequence:Pause()

Pauses sequence playback, moving the Tween Sequence to the Paused state.

  • Only takes effect if the Tween Sequence is in the Playing state.
  • Regular Tween behaviors apply according to the currently paused Tweens.
function TweenSequence:Play() -> ts TweenSequence

Starts sequence playback, moving the Tween Sequence to the Playing state.

  • Only takes effect if the Tween Sequence is in the Initial state.
  • Regular Tween behaviors apply according to the currently playing Tweens.
Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:Restart()

Restarts Tween Sequence playback, moving the Tween Sequence to the Playing state.

  • Only takes effect if the Tween Sequence is not in the Initial state.
  • The target values of all Tweens will be restored to their Initial state.
  • Regular Tween behaviors apply to all affected Tweens.
function TweenSequence:Resume()

Resumes sequence playback, moving the Tween Sequence to the Playing state.

  • Only takes effect if the Tween Sequence is in the Paused state.
  • Regular Tween behaviors apply according to the resumed Tweens.
function TweenSequence:SetLoops(loops: number) -> ts TweenSequence

Sets the number of times the Tween Sequence will complete playback before moving to the Completed state and returns the current instance.

  • The number of loops can only be set if the Tween Sequence is in the Initial state.
  • The Tween Sequence will always play at least once; a negative value will cause the Tween Sequence to loop indefinitely.
Parameters
loopsnumber

The number of times to loop playback.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:SetOnComplete(onComplete: fun() -> nil) -> ts TweenSequence

Sets the OnComplete callback and returns the current instance.

  • Callbacks can only be set if the Tween Sequence is in the Initial state.
  • The OnComplete callback is called when all the events in the Tween Sequence have ended.
Parameters
onCompletefun() -> nil

The function to call when the Tween Sequence completes.

Returns
tsTweenSequence

The current Tween Sequence instance.

function TweenSequence:SetOnStepComplete(onStepComplete: fun() -> nil) -> ts TweenSequence

Sets the OnStepComplete callback and returns the current instance.

  • Callbacks can only be set if the Tween Sequence is in the Initial state.
  • The OnStepComplete callback is called when the Tween Sequence loops or completes playback.
Parameters
onStepCompletefun() -> nil

The function to call when the Tween Sequence loops or completes playback.

Returns
tsTweenSequence

The current Tween Sequence instance.