TweenBase

TweenBase : Instance

Overview

The parent class for tween Objects created by the TweenService:Create() method.

Properties

PlaybackState

Enum.PlaybackState

The current state of the tween (read-only).

Code Samples

print(Tween.PlaybackState)

Methods

Cancel

The Stops the tween's playback and resets its internal state.

Property values changed by the tween are not reverted to their initial values.

Parameters

Return

void

Code Samples

Tween:Cancel() -- Stop and reset the Tween

Pause

Pauses a playing tween when its state is Playing. The tween's internal state, including progress, is not reset, so calling Play() method resumes from the paused point.

Parameters

Return

void

Code Samples

Tween:Pause() -- Pause the animation
wait(1)
Tween:Play()  -- Resume from the paused position

Play

Starts the tween's playback.

If already playing, calling Play() method has no effect. If playback is completed or stopped via Cancel() or Pause() method, this function can restart it.

Multiple tweens with different properties can run simultaneously on the same Object, but if two tweens target the same property, the existing tween is canceled, and only the latest tween runs.

Parameters

Return

void

Code Samples

Tween:Play() -- Start or resume the animation

Events

Completed

Runs when the tween completes its playback or is stopped by Cancel().

Passes the reason for tween termination to the connected function.

Parameters

Enum.PlaybackState playbackState

The state of the tween upon termination

Code Samples

local function OnCompleted(playbackState)
    print("Tween Complete!", playbackState)
end
Tween.Completed:Connect(OnCompleted)

See also

Tween

Last updated