TweenInfo

Overview

Description

TweenInfo is an object used in Lua to set the properties of a Tween when using the Tween service. It defines the behavior of a Tween, such as its duration, easing style, direction, repeat count, and more.

Properties

Time

number

Specifies the total duration (in seconds) of the Tween. The Tween will play for this amount of time.

Code Samples

local TweenInfoData = TweenInfo.new(
    2,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

print(TweenInfoData.Time)

EasingStyle

EasingStyle

Defines the easing style of the animation, which determines how the animation progresses in terms of speed at the beginning and end. Examples: Enum.EasingStyle.Linear, Enum.EasingStyle.Quad.

Code Samples

local TweenInfoData = TweenInfo.new(
    2,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

print(TweenInfoData.EasingStyle)

EasingDirection

EasingDirection

Sets the direction for the easing style. It defines how the animation progresses either forward, backward, or both ends. Examples: Enum.EasingDirection.In, Enum.EasingDirection.Out.

Code Samples

local TweenInfoData = TweenInfo.new(
    2,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

print(TweenInfoData.EasingDirection)

RepeatCount

number

Specifies the number of times the animation repeats. Set it to 0 for no repetition.

Code Samples

local TweenInfoData = TweenInfo.new(
    2,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

print(TweenInfoData.RepeatCount)

Reverses

boolean

Determines whether the animation will play in reverse once it reaches the end. If true, it will play in reverse.

Code Samples

local TweenInfoData = TweenInfo.new(
    2,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

print(TweenInfoData.Reverses)

DelayTime

number

Represents the delay time (in seconds) before the Tween starts. The Tween will begin after this delay.

Code Samples

local TweenInfoData = TweenInfo.new(
    2,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

print(TweenInfoData.DelayTime)

Constructors

new

This is the constructor used to initialize a TweenInfo object. You can pass various parameters to define the properties of the Tween.

Parameters

number InTime

Duration of the Tween (in seconds)

Enum.EasingStyle InEasingStyle

Easing style (e.g., Linear, Quad, etc.)

Enum.EasingDirection InEasingDirection

Easing direction (e.g., In, Out, etc.)

number InRepeatCount

Number of repetitions

boolean InReverses

Whether the animation will reverse

number InDelayTime

Delay time before starting

Return

TweenInfo

Returns the TweenInfo instance

Code Samples

local TweenInfoData = TweenInfo.new(
    2,                         -- Time               
    Enum.EasingStyle.Linear,   -- EasingStyle
    Enum.EasingDirection.Out,  -- EasingDirection
    0,                         -- RepeatCount     
    false,                     -- Reverses
    0                          -- DelayTime
)

Last updated