TweenBase

TweenBase : Instance

Overview

The TweenBase class provides the foundational structure for handling Tween animations, allowing developers to control and monitor the animation lifecycle.

Description

The TweenBase class serves as the parent class for objects like Tween, offering fundamental methods and properties for initiating, pausing, canceling, and tracking the state of animations. Its design ensures a consistent and reliable workflow for managing various types of animations in game development.

Properties

PlaybackState

Enum.PlaybackState

The PlaybackState property represents the current state of the Tween. It can be set to values like Playing, Paused, or Canceled, allowing developers to track the animation's progress and control its behavior.

Code Samples

print(Tween.PlaybackState)

Methods

Cancel

The Cancel method immediately stops the Tween animation and resets it to its initial state, discarding any progress made during the animation.

Parameters

Return

void

Code Samples

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

Pause

The Pause method temporarily halts the Tween animation, allowing it to resume later while maintaining its current progress.

Parameters

Return

void

Code Samples

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

Play

The Play method starts or resumes the Tween animation from its current position, allowing it to transition toward its goal as specified.

Parameters

Return

void

Code Samples

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

Events

Completed

The Completed event is triggered when the Tween finishes playing, either through reaching its natural end or after being stopped with the Play method.

Parameters

Code Samples

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