TweenService
Interpolates instance properties over time.
- Service
game:GetService("TweenService")- Inherits
- Instance
- Replication
- Never
Behavior
TweenService creates Tween values that interpolate
instance properties using TweenInfo timing.
It is available on the server and clients. Run player-specific interface
animations on the client.
Summary
Create(instance: Instance, tweenInfo: TweenInfo, propertyTable: { [string]: any }): Tweenserial onlyCreates a tween from an instance, a TweenInfo, and a table of target property values.
Returns this instance if it is an ExecutionGroup.
Evaluates an easing curve at the supplied normalized progress.
SmoothDamp(current: Vector3, target: Vector3, velocity: Vector3, smoothTime: number, maxSpeed: number?, deltaTime: number?): (Vector3, Vector3)parallel readMoves a value toward a target using damped interpolation and returns the updated value and velocity.
Methods
Create
TweenService:Create(instance: Instance, tweenInfo: TweenInfo, propertyTable: { [string]: any }): TweenCreates a tween from an instance, a TweenInfo, and a table of target property values. Call Play on the result to start it.
Starting values are captured when playback begins. Supported interpolated values include numbers, Vector3, CFrame, Color3, and UDim2. Unsupported properties produce an error. Anchor parts before tweening their transforms to prevent physics from changing the same properties.
GetExecutionGroup
TweenService:GetExecutionGroup(): ExecutionGroup?Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.
GetValue
Evaluates an easing curve at the supplied normalized progress.
SmoothDamp
TweenService:SmoothDamp(current: Vector3, target: Vector3, velocity: Vector3, smoothTime: number, maxSpeed: number?, deltaTime: number?): (Vector3, Vector3)Moves a value toward a target using damped interpolation and returns the updated value and velocity.
Inherited members
- Properties
- ArchivableClassNameNameParent
- Methods
- AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
- Events
- AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying
Examples
-- Requires an anchored Part named Door.
local TweenService = game:GetService("TweenService")
local door = workspace:WaitForChild("Door")
local tween = TweenService:Create(door, TweenInfo.new(1), { Transparency = 1 })
tween:Play()-- Server Script. Requires an anchored Part named Door in workspace.
local TweenService = game:GetService("TweenService")
local door = workspace:WaitForChild("Door")
local info = TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local open = door.CFrame * CFrame.new(0, 0, 8)
local tween = TweenService:Create(door, info, { CFrame = open })
tween:Play()