Tween¶
Extends EngineObject.
An animation that tween.value, tween.property and tween.field start: a number, a vector, a colour (a linear-RGB vector) or a rotation (slerped) moving from one value to another over some seconds, with an easing curve. It plays by itself, on the game clock (or the real clock with the unscaled option), stepped by LuauVm.AdvanceTime. A playing tween stays alive when the script drops the handle. A tween on a property or a component field makes no Luau call per frame.
Properties¶
playing: booleanTrue while the tween runs (it is not paused and has not ended). Read-only.paused: booleanTrue while the tween is paused with Pause. An ended tween is not paused. Read-only.progress: numberHow far the current pass has got, from 0 to 1, in time (the easing curve is not applied). It is 1 once the tween has completed. Read-only.duration: numberThe seconds one pass takes (not counting the delay or the repeats). Read-only.ease: EaseThe easing curve. Read-only.
Signals¶
completed: Signal<()>Emitted once when the tween ends by reaching its last value, after that value is written. A tween that repeats forever never emits it.cancelled: Signal<()>Emitted once when the tween ends early: Cancel, a setter that raised an error, or a target that is gone (a destroyed object, a dead entity, a removed component).
Methods¶
cancel¶
function cancel(self): ()
Stops the tween where it is: the value stays what the last step wrote, and cancelled is emitted. Does nothing once the tween has ended.
complete¶
function complete(self): ()
Jumps to the end value (the last pass's: to, or from when the tween reverses an odd number of times), writes it and emits completed. For a tween that repeats forever it stops at to. Does nothing once the tween has ended.
pause¶
function pause(self): ()
Holds the tween, delay included, until Resume. A paused tween is still alive: it keeps the object it animates and does not end.
resume¶
function resume(self): ()
Lets a paused tween go on from where it stopped.
wait¶
function wait(self): boolean