Skip to content

tween

A global table of functions: tween.<function>(…).

value

tween.value: <T>(from: T, to: T, seconds: number, set: (T) -> (), options: TweenOptions?) -> Tween

Animates a number, a vector (also a colour: linear RGB, as Light.color) or a Quat (slerped) from from to to in that many seconds, calling set with the value each step. from and to must be the same kind. The tween plays by itself, even if the script drops the handle. Nothing is set at once: the first call is in the next step, and the last one is exactly to.

property

tween.property: (object: any, name: string, to: number | vector | Quat, seconds: number, options: TweenOptions?) -> Tween

Animates a property of an engine object (a number, vector or Quat one that can be set) from its value when the delay ends to to. No Luau runs per step. The tween is cancelled if the object is destroyed.

field

tween.field: (world: World, entity: number, component: number, field: string, to: number | vector | Quat, seconds: number, options: TweenOptions?) -> Tween

Animates a field of an entity's component (a number, vector, Quat, or a world position) from its value when the delay ends to to, writing it in place and telling the world it changed. No Luau runs per step. The tween is cancelled if the entity dies or loses the component.

ease

tween.ease: (ease: Ease, t: number) -> number

The easing curve at time t (0 to 1, clamped): 0 at 0 and 1 at 1, and the eased progress in between (curves such as back and elastic overshoot).