← Declarative motion

Motion.slideIn

luastra/motion
Motion.slideIn(options: any?): MotionMap

Returns a MotionMap that combines translation with the preset's arrival timing, moving content from an offset into its final layout position. Layout is calculated at the destination; motion changes only the rendered transform.

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.slideIn to introduce a panel, card, or route whose direction reinforces where it came from. Do not use it to repair layout spacing, and keep the distance modest for frequently repeated elements.

Parameters

ParameterType / valuesDescription
optionsany?Optional starting translation, duration, and easing overrides.
options.xfinite number?Optional horizontal starting offset; omit it for no horizontal channel.
options.yfinite number?Optional vertical starting offset; defaults to 18 when x is also omitted.
options.durationMsnumber (0..60000)?Optional movement duration; defaults to 240 ms.
options.easing"linear" | "easeOutCubic" | "easeInOutCubic"?Optional interpolation curve; defaults to "easeOutCubic".

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.slideIn { y = 24, durationMs = 300 }

Complete inventory

View all pages in Declarative motion
← Previous: Motion.fadeInNext: Motion.scaleIn →