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 tweenInfo = TweenInfo.new(2)  -- Tween duration is 2 seconds

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 tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Bounce)  -- Apply Bounce easing style

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 tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)

RepeatCount

number

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

Code Samples

local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 3)

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 tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, true)

DelayTime

number

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

Code Samples

local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)

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

-- Creating TweenInfo
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 1, true, 0.5)

Last updated