Motion.sequence
luastra/motionMotion.sequence(steps: { Tween | Wait }, iterations: number?): SequenceCombines Tween and Wait steps into one ordered value for a single motion channel, optionally repeating the sequence. Each step begins after the previous step finishes, so timing remains deterministic across hosts.
Before you use it
Add luastra/motion to this module's dependencies in luastra.json, then import it with require("luastra/motion"). Motion itself needs no capability; a visible result requires ui.render and a component that accepts the returned descriptor through its motion field.
How it fits
The function returns immutable motion data synchronously. Assign a preset MotionMap directly, or place Tween/Sequence values under supported motion channel names; the host animates without rerunning app.render on every frame.
When to use it
Use Motion.sequence for multi-stage motion of one property, such as fade-hold-fade or rotate-return. It is not a MotionMap by itself: assign the Sequence as a channel value inside the component's motion table.
Parameters
| Parameter | Type / values | Description |
|---|---|---|
| steps | { Tween | Wait } | Ordered dense array containing only Tween or Wait values for one channel. |
| iterations | number? | Optional repetition count; use the documented infinite value only for intentional ambient motion. |
Returns
Sequence — an immutable ordered motion-channel sequence containing Tween and Wait steps.
What happens next
A descriptor or MotionMap ready to attach to a supported UI node.
Failures and fixes
Unknown options, invalid bounds, or unsupported channels fail validation. Motion must not drive application logic; use Timer for state changes, and rely on the host to present the final state when reduced motion is enabled.
Availability
Public-source alpha API in 0.5.0-alpha; presentation follows host and reduced-motion policy.
Focused example
local Motion = require("luastra/motion")
local reveal = Motion.sequence({
Motion.wait(300),
Motion.tween { from = 0, to = 180, durationMs = 500 },
}, 1)
local motion = { rotationYDeg = reveal }