PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

TweenInfo

Tween

TweenInfo

Read-only property that includes information on how the interpolation of the Tween is to be carried out, using the TweenInfo data type. The TweenInfo data type includes a range of properties that can be used to achieve various styles of animation, including reversing and looping Tweens (see examples).

As with all Tween properties, the TweenInfo property is read only. If a developer wants to modify the TweenInfo of a Tween they must create a new Tween using TweenService/Create.


Code Samples


Looping a Tween

This code sample includes an example of how a looped tween can be created.

A part is instanced in the Workspace, and a Tween is created using TweenService:Create that is set to animate it’s position along the Y axis. The looped effect is achieved by modifying the TweenInfo used in TweenService:Create. Specifically, when RepeatCount is set to be less than 0 the tween will play indefinitely. Also, setting Reverses to true will cause the tween to play in reverse once it has reached it’s destination. In combination this creates a looped effect.

The correct way to make a tween play indefinitely is to set RepeatCount to -1. Developers should avoid using large numbers (or math.huge) as a substitute as this is unstable and may stop working at any point.


TweenInfo Examples

An example of the range of different interpolation effects that can be used in Tweens.