← Declarative motion

Motion.fadeIn

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

Returns a complete MotionMap that transitions opacity from a lower value to fully visible using bounded preset defaults and optional overrides. The map can be assigned directly to a component's motion property.

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.fadeIn for newly appearing supporting content when opacity communicates entry without changing layout. Avoid it for essential immediate feedback or when reduced motion should present the final state instantly.

Parameters

ParameterType / valuesDescription
optionsany?Optional opacity-transition duration, easing, and preset overrides.
options.durationMsnumber (0..60000)?Optional fade duration; defaults to 180 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.fadeIn { durationMs = 240 }

Complete inventory

View all pages in Declarative motion
← Previous: Motion.sequenceNext: Motion.slideIn →