Struct AnimationSequenceStep
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
One step in an animation sequence played by UseAnimationSequence(IReadOnlyList<AnimationSequenceStep>, object?[]?, bool, bool). A step is exactly one of: a variant-label change (To(string, StyleTransitionConfig?, float?)), a pure timing gap (Wait(float)), a synchronous C# callback (Call(Action)), or a wait on a task (Await(Func<CancellationToken, VelvetTask>)).
public readonly struct AnimationSequenceStep
Properties
- AwaitFactory
The function whose task the step waits on. Non-null only on an Await(Func<CancellationToken, VelvetTask>) step.
- Callback
The callback to invoke. Non-null only on a Call(Action) step.
- HoldSec
How long the sequence holds on this step before advancing. On a To(string, StyleTransitionConfig?, float?) step, null derives the hold from Transition:
DurationSec + DelaySecfor Tween or Bezier, and for Spring itsDelaySecplus the duration Framer Motion's sequence gives the same spring. A Bezier or Spring Repeat below 20 lengthens that by every pass and the waits between them; the motion guide's Timelines section says what one of 20 or more does. Required on Wait(float) (negative values clamp to 0). Always 0 on Call(Action) and Await(Func<CancellationToken, VelvetTask>).
- Label
The variant label to activate. Non-null only on a To(string, StyleTransitionConfig?, float?) step.
- Transition
The transition driving this label change. Null means "reuse the most recent non-null transition earlier in the sequence", falling back to StyleTransition's
Fadepreset (the same defaultV.Motionitself uses) if none has been set yet. Only meaningful on a To(string, StyleTransitionConfig?, float?) step.
Methods
- Await(Func<CancellationToken, VelvetTask>)
Calls
taskFactoryon arrival and holds the cursor until the task it returns settles — anawaitbetween the animations of Framer Motion'suseAnimate. A restart, adepschange or unmount that leaves the step with the task still pending cancels the token. The motion guide's Timelines section owns what a settle, a fault and a pause do.
- Call(Action)
Fires
callbacksynchronously on arrival, then advances immediately — never holds the cursor. Step 0's callback re-fires under the Editor's StrictMode mount double-invoke diagnostic (same expectation as anyUseEffectmount factory with a non-idempotent body), so write it to tolerate running twice if the sequence's own mount matters.
- To(string, StyleTransitionConfig?, float?)
Activates
labelon the sequence's coordinator — feeds straight intoV.Motion(animate:, transition:). Descendant Motions naming no label of their own inherit it exactly as they do for any hand-toggled label, includingStaggerChildrenSecfan-out whentransitiondeclares it — "one at a time" across a list of such descendants needs no separate multi-target API.
- Wait(float)
Holds the current label for
secondsbefore advancing. No visual effect of its own.