Class MotionNode
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Element node that participates in animations. A variant Initial/Animate pair plays its mount enter on ANY Motion, standalone or under AnimatePresence; Exit requires AnimatePresence (something must defer the unmount for the removal to animate against) and switches CSS classes on unmount based on the transition definition. Inline styles (StyleOverrides) are intentionally not supported. Apply styles via USS classes.
public sealed class MotionNode : BaseElementNode
- Inheritance
-
objectMotionNode
- Inherited Members
Properties
- Animate
The active variant label for this node (a key of Variants); null inherits the nearest ancestor Motion's active label.
- Exit
Exit variant label. When this Motion is the direct child of an AnimatePresence and sets Exit + Animate + Variants, removal animates from the resting
variants[Animate]tovariants[Exit](using the Transition timing) before the element unmounts. Unlike Initial, this genuinely needs AnimatePresence — something must defer the unmount for the removal to animate against — so it is inert (and logs a warning) outside one. Null = use the transition's own ExitFrom/ExitTo classes.
- Initial
Mount-time starting variant label. When this Motion sets Initial + Animate + Variants, the enter starts the element at
variants[Initial]and transitions tovariants[Animate](which it then rests at, persistently) using the Transition timing. Works the same whether this Motion is the direct child of an AnimatePresence or mounts standalone —initial/animateapply to any Motion node; AnimatePresence is only required for Exit. Null = no variant initial state.
- LayoutId
Shared-element layout animation identity. When a Motion carrying this same string patches at a resolved layout rect (position and/or size) different from the rect the SAME id last settled at — including a different physical element entirely, e.g. after a same-key type flip or a move to a different parent — it tweens from the old rect to the new one (FLIP: capture the old rect, let layout settle at the new one, apply an inverse transform, then spring that inverse back to zero) instead of jump-cutting. Independent of Variants/ Animate: a layoutId tween runs from the ACTUAL rect delta, not a class-defined from/to pair. Null = no layout animation (ordinary jump-cut on a rect change, matching every other element). Two Motions in the same tree must never share a live layoutId simultaneously — the second one to patch silently steals the registration (see MotionLayoutIdDriver).
- OnEnterComplete
Callback invoked when the enter animation completes. Fires for a variant Initial/Animate enter whether this Motion sits under AnimatePresence or mounts standalone. Invoked immediately when StyleTransitionConfig.None, and also synchronously inside Reconcile when the enter animation is skipped entirely (a presence-suppressed first mount, or a variant Motion with no resolvable initial state). On asynchronous animation completion via schedule.Execute, called outside of Reconcile, so SetState() is safe.
- Transition
Transition configuration.
- Variants
Named animation states: each label maps to a utility-class string. Carried RAW (never baked into ClassNames): the effective label is resolved at reconcile time — this node's Animate, else the nearest ANCESTOR Motion's active label (parent→child propagation) — and applied against these variants.