TweenService
TweenService : Instance
Overview
TweenService allows the creation of tween Objects for animation effects.
The functionality of a tween depends on the properties set during its creation.
CFrame
CFrame
Vector3
Position, Orientation, Size
Color3
Color
number
Transparency
bool
CanCollide
UDim2
Position, Size
Properties
Methods
Create
Creates a new tween animation for a specific instance. Arguments passed to the Create() method define the instance to apply the tween to, the TweenInfo defining the tween's behavior, and the properties apply tween to.
Parameters
Instance
Instance
The target tween Object
TweenInfo
TweenInfo
An Object that sets the duration, EasingStyle, and repeat count of tween
Value
PropertyTable
A dictionary defining the properties and target values to apply tween to
Return
Instance
The created tween Object
Code Samples
local TweenService = game:GetService("TweenService")
local Part = script.Parent
-- Setting Tween information
local TweenInfoData = TweenInfo.new(
5, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- Number of repetitions (-1 for infinite)
false, -- Reverses
0 -- DelayTime
)
-- Properties to be changed with the tween
local TweenGoals =
{
Position = Vector3.new(-400, 50, -350)
}
local Tween = TweenService:Create(Part, TweenInfoData, TweenGoals)
Tween:Play()
Events
See also
TweenLast updated