Motion.pulse
luastra/motionMotion.pulse(options: any?): MotionMap
Returns a repeating scale MotionMap that expands and contracts around the component's normal size. The component keeps its original layout bounds while the transform provides visual emphasis.
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.pulse sparingly for a current target, waiting object, or time-sensitive affordance. Do not run it continuously on many elements or use motion as the only way to convey status.
Parameters
| Parameter | Type / values | Description |
|---|---|---|
| options | any? | Optional scale, duration, and iteration settings for the pulse preset. |
| options.scale | number (0..100)? | Optional peak scale; defaults to 1.04. |
| options.durationMs | number (0..60000)? | Duration of each expand or contract leg; defaults to 420 ms. |
| options.pauseMs | number (0..60000)? | Optional delay appended after each pulse; defaults to 0. |
| options.iterations | integer (0..1000)? | Cycle count; defaults to 1 and 0 means continuous. |
| options.easing | "linear" | "easeOutCubic" | "easeInOutCubic"? | Optional interpolation curve; defaults to "easeInOutCubic". |
Returns
MotionMap — a complete property-to-motion map that can be assigned directly to a supported component motion field.
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 motion = Motion.pulse { scale = 1.05, durationMs = 1800, iterations = 0 }