Method UseAnimationSequence
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
UseAnimationSequence(IReadOnlyList<AnimationSequenceStep>, bool, bool, object?[]?)
Plays an ordered AnimationSequenceStep array over time, exposing the active step's
label/transition to feed straight into a coordinator V.Motion(animate:, transition:).
Velvet's timeline primitive: the hook owns the clock (via UseFrame(Action<float>, int)) and the step
walk, so a caller never hand-rolls
UseEffect(Func<Action?>?, object?[]?) plus a timer plus UseState<T>(T) to
sequence a multi-stage animation. Descendant V.Motion nodes with no own animate
inherit the coordinator's label exactly as they already do for any hand-toggled label change; "one
at a time" fan-out across a list of such descendants is StaggerChildrenSec on a step's own
Transition — there is no separate multi-target API.
public static (AnimationSequenceState state, AnimationSequenceControls controls) UseAnimationSequence(IReadOnlyList<AnimationSequenceStep> steps, bool autoplay = true, bool loop = false, object?[]? deps = null)
Parameters
stepsIReadOnlyList<AnimationSequenceStep>The ordered sequence. Must not be null.
autoplayboolStarts advancing on mount when true (default). When false, call
controls.Play()— e.g. from anonClickhandler — to start it on demand. Only read on mount / adepschange, not on every render, so a latercontrols.Pause()is not fought by a re-render that keeps passingautoplay: true.loopboolWhen true, the cursor wraps to step 0 after the last step's hold elapses and IsComplete never latches.
depsobject[]Unlike UseEffect(Func<Action?>?, object?[]?), omitting this (or passing null) resets the walker on MOUNT ONLY, not on every render — a freshly-built
stepsarray literal in the component body (the common case) must not restart an in-flight sequence every render. Pass an explicit array to restart the sequence when one of its entries changes, same convention as every other deps-taking hook.
Returns
- (AnimationSequenceState state, AnimationSequenceControls controls)