Tween¶
Static Class
This object is a static class. It can be accessed by using it's name as a keyword like this Tween
.
Additionally, it cannot be created in the creator menu or with Instance.New()
Tween is a static class used for tweening properties of instances, such as Position, Rotation and Size.
Overlapping Tweens
Multiple tweens can be applied on the same object at the same time, but they must not be tweening the same property. Only the latest tween will override any other one being applied to the property.
Methods¶
TweenColor → void
¶
Parameters
startValue [ Color ]
endValue [ Color ]
time [ number
]
callPerStep [ function
]
type [ TweenType
]
callback [ function
]
Tweens a color between two specified values.
Example
Tween:TweenColor(Color.New(1,1,1,1), Color.New(1,1,1,0), 5, function(val)
part.Color = val
end, TweenType.linear, function()
print("Tween finished")
end
TweenNumber → void
¶
Parameters
startValue [ number
]
endValue [ number
]
time [ number
]
callPerStep [ function
]
type [ TweenType
]
callback [ function
]
Tweens a number between two specified values.
Example
Tween:TweenNumber(1, 10, 1, function(val)
print(val)
end, TweenType.linear, function()
print("Tween finished")
end)
TweenPosition → void
¶
Parameters
target [ DynamicInstance ]
destination [ Vector3 ]
time [ number
]
type [ TweenType
]
callback [ function
]
Tweens the position of a DynamicInstance
Example
Tween:TweenPosition(part, Vector3.New(100, 0, 0), 100, TweenType.linear, function()
print("I have arrived!")
end)
TweenRotation → void
¶
Parameters
target [ DynamicInstance ]
destination [ Vector3 ]
time [ number
]
type [ TweenType
]
callback [ function
]
Tweens the rotation of a DynamicInstance
Rotation is in euler angles.
Example
Tween:TweenRotation(part, Vector3.New(0, 90, 0), 1, TweenType.linear, function()
print("Rotating finished")
end)
TweenSize → void
¶
Parameters
target [ DynamicInstance ]
endValue [ Vector3 ]
time [ number
]
type [ TweenType
]
callback [ function
]
Tweens the size of a DynamicInstance
Example
Tween:TweenSize(part, Vector3.New(5, 5, 5), 1, TweenType.linear, function()
print("Sizing finished")
end)
TweenVector2 → void
¶
Parameters
startValue [ Vector2 ]
endValue [ Vector2 ]
time [ number
]
callPerStep [ function
]
type [ TweenType
]
callback [ function
]
Tweens a vector2 between two specified values.
Example
Tween:TweenVector2(Vector2.New(0,0), Vector2.New(0,50), 5, function(val)
UIView.PositionOffset = val
end, TweenType.linear, function()
print("Tween finished")
end)
TweenVector3 → void
¶
Parameters
startValue [ Vector3 ]
endValue [ Vector3 ]
time [ number
]
callPerStep [ function
]
type [ TweenType
]
callback [ function
]
Tweens a vector3 between two specified values.
Example
Tween:TweenVector3(Vector3.New(0,0,0), Vector3.New(0,50,0), 5, function(val)
part.Position = val
end, TweenType.linear, function()
print("Tween finished")
end)