TweenService¶
Inherits Instance
Tween animates the properties of an object over time. Use Tween:Create with a target, an info table (Time, Style, Direction, ...) and a goals table (property = goal value), then call :Play() on the returned tween.
Example usage:
local part = script.Parent
local tween = Tween:Create(part, { Time = 2, Style = "quad", Direction = "out" }, {
Position = part.Position + Vector3.New(0, 10, 0),
Color = Color.New(0, 1, 0)
})
tween:Play()
tween.Finished:Wait()
print("Done!")
Static Class
This object is a static class. It can be accessed like this: Tween.
Additionally, it cannot be created in the creator menu or with Instance.New().
Not newable
This object cannot be created by scripts using Instance.New().
Methods¶
Create → TweenObject¶
Creates a tween that animates the given properties of target to their goal values. info is a table of options: Time (seconds, default 1), DelayTime (seconds), Style (one of linear, sine, quint, quart, quad, expo, elastic, cubic, circ, bounce, back, spring), Direction (in, out, inout, outin), Reverses (boolean) and RepeatCount (number, -1 for infinite). goals maps property names to target values, e.g. { Position = Vector3.New(0, 10, 0) }. Call :Play() on the returned tween to start it.