Skip to content

Motion

Types

Spring type

luau
type Spring<T> = {
	impulse: (self: Graph.Node<T>, delta: T) -> (),
	setVelocity: (self: Graph.Node<T>, velocity: T) -> (),
}

Properties

NodeToMotion Read Only

luau
Motion.NodeToMotion: { [Graph.Node<any>]: Engine.Spring | Engine.Tween }

Color Module

luau
Motion.Color: Color

DataType Module

luau
Motion.DataType: DataType

Engine Module

luau
Motion.Engine: Engine

Functions

isMotion

luau
Motion.isMotion(obj: unknown): boolean

Returns whether the given value is a reactive motion.

spring

luau
Motion.spring<T>(target: T, frequency: number?, damping: number?): Graph.Node<T> & Spring<T>

Creates a node that springs toward target, animating any supported value type (numbers, Vector2, UDim2, Color3, …). When target is reactive the spring re-targets on every change, carrying its momentum through. Read the returned node anywhere to subscribe to the live animated value.

Open Documentation

Parameters

  • target: The goal value, static or a reactive node; the spring eases toward it.
  • frequency: Oscillations per second, where higher snaps faster. Defaults to a tuned value; may be reactive.
  • damping: The damping ratio: 1 is critically damped (no overshoot), <1 springs past and settles, >1 is sluggish. May be reactive.

tween

luau
Motion.tween<T>(target: T, tweenInfo: TweenInfo?): Graph.Node<T>

Creates a node that animates toward target over a fixed duration described by a TweenInfo (easing style, direction, time, repeats). When target or the TweenInfo is reactive the tween restarts toward the new goal. Read the returned node to subscribe to the live animated value. Prefer a Flux.spring for momentum-driven, interruptible motion.

Open Documentation

step from Engine

luau
Motion.step(now: number?)

Advances every active spring and tween by one frame. Wired automatically to each RunService.Heartbeat under Roblox, so you rarely call it yourself; drive it manually only when stepping motion deterministically in tests.

Open Documentation