TweenService
TweenService is used to create Tweens which are used to interpolate, or tween, the properties of instances. Tweens can be used on any object with compatible property types.
Memory category | Instances |
---|
Member index 3
Description
Tweens are used to interpolate the properties of instances. These can be used to create animations for various Roblox objects. Almost any numeric property can be tweened using TweenService. Note that only specific types of properties can be used with TweenService. The types of properties that can be tweened are:
TweenService's constructor function, TweenService:Create(), takes
information about the animation and generates the Tween object which
can be used to play the animation. Note that Tweens
can animate multiple
properties at the same time.
Details on how the interpolation of the tween is to be carried out are given
in the tweenInfo parameter of TweenService:Create(). 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).
Multiple tweens can be played on the same object at the same time, but they must not be animating the same property. If two tweens attempt to modify the same property, the initial tween will be cancelled and overwritten by the most recent tween (see examples).
Although other methods exist for tweening objects, such as GuiObject:TweenSizeAndPosition(), TweenService allows multiple properties to be modified and for the animation to be paused and cancelled at any point.
History 7
Members 3
Create
Parameters (3) | ||
---|---|---|
instance | Instance | |
tweenInfo | TweenInfo | |
propertyTable | Dictionary | |
Returns (1) | ||
Tween |
The Create function of TweenService creates a new Tween. The function takes three arguments: the object to tween, the TweenInfo to use, and a table containing the properties to tween and the values to tween to.
Tweens are used to interpolate the properties of instances. These can be used to create animations for various Roblox objects. Almost any numeric property can be tweened using TweenService.
The propertyTable parameter that is passed in needs to be a dictionary where the keys are the string names of the property (e.g. "Position", "Transparency", "Color", etc), and the value is the value the property needs to be at the end of the tween. Note that only specific types of properties can be used with TweenService, but multiple properties can be animated in the same tween. The types of properties that can be tweened are:
The Tween created using this function is unique to the object given as the instance parameter. To apply the same tween to another object, call this function again with the new object.
Details on how the interpolation of the tween is to be carried out are given in the TweenInfo parameter, such as reversing, looping and easing.
Thread safety | Unsafe |
---|
GetValue
Parameters (3) | ||
---|---|---|
alpha | float | |
easingStyle | EasingStyle | |
easingDirection | EasingDirection | |
Returns (1) | ||
float |
Returns a new alpha value for interpolating using the given alpha value, EasingStyle, and EasingDirection.
The provided alpha value is clamped between 0 and 1.
Thread safety | Unsafe |
---|
SmoothDamp
Parameters (6) | ||
---|---|---|
current | Variant | |
target | Variant | |
velocity | Variant | |
smoothTime | float | |
maxSpeed | float? | |
dt | float? | |
Returns (2) | ||
Variant | ||
Variant |
Thread safety | Unsafe |
---|
History 1
- 636 Add SmoothDamp