Tween
Tween : TweenBase
Overview
Tween Objects are used to gradually change property values over time for animation effects.
Once set, a tween's goal cannot be modified, and multiple tweens cannot be applied to the same property simultaneously. If multiple tweens target the same property, the existing tween is canceled, and the latest tween takes precedence.
Properties
Instance
Instance
Retrieves the instance set for the tween Object (read-only).
Code Samples
print(Tween.Instance)
TweenInfo
TweenInfo
Retrieves the TweenInfo set for the tween Object (read-only).
Code Samples
local tweenInfo = Tween.TweenInfo
print(tweenInfo.Time)
print(tweenInfo.EasingStyle)
print(tweenInfo.EasingDirection)
print(tweenInfo.RepeatCount)
print(tweenInfo.Reverses)
print(tweenInfo.DelayTime)
Methods
Play
Starts the tween's playback.
If already playing, calling Play() method has no effect. If playback is completed or stopped via Cancel() or Pause() method, this function can restart it.
Multiple tweens with different properties can run simultaneously on the same Object, but if two tweens target the same property, the existing tween is canceled, and only the latest tween runs.
Parameters
Return
void
Code Samples
Tween:Play()
Cancel
Stops the tween's playback and resets its internal state.
Property values changed by the tween are not reverted to their initial values.
Parameters
Return
void
Code Samples
Tween:Cancel()
Pause
Pauses a playing tween when its state is Playing. The tween's internal state, including progress, is not reset, so calling Play() method resumes from the paused point.
Parameters
Return
void
Code Samples
Tween:Pause() -- Pause
wait(2)
Tween:Play() -- Resume
Events
See also
TweenLast updated