Method UseAnimationSequence
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
UseAnimationSequence(IReadOnlyList<AnimationSequenceStep>, object?[]?, bool, bool)
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 naming no label of their own
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, object?[]? deps, bool autoplay = true, bool loop = false)
Parameters
stepsIReadOnlyList<AnimationSequenceStep>The ordered sequence. Must not be null.
depsobject[]When the sequence restarts from step 0, read as UseEffect(Func<Action?>?, object?[]?) reads its list: on a changed entry, or on every render for null. A sequence meant to play once per mount passes an empty array.
autoplayboolStarts advancing on mount when true (default). When false, call
controls.Play()— e.g. from anonClickhandler — to start it on demand. Read only wheredepsrestarts the sequence, 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 latches only for an empty
stepslist.
Returns
- (AnimationSequenceState state, AnimationSequenceControls controls)
UseAnimationSequence(IReadOnlyList<AnimationSequenceStep>, object?[]?, int, bool, float)
Plays steps as the overload taking loop does, a fixed number of times: the
Web Animations API's iterations and CSS's animation-iteration-count. Each pass after the
first starts at step 0 once the last step's hold elapses, and
IsComplete latches when the last pass's last hold elapses, with
that pass's last step still current. A gap between passes is repeatDelaySec, Framer
Motion's repeatDelay; under loop a trailing Wait(float) step
is the same gap, since no completion waits behind it.
public static (AnimationSequenceState state, AnimationSequenceControls controls) UseAnimationSequence(IReadOnlyList<AnimationSequenceStep> steps, object?[]? deps, int iterations, bool autoplay = true, float repeatDelaySec = 0)
Parameters
stepsIReadOnlyList<AnimationSequenceStep>The ordered sequence. Must not be null.
depsobject[]As on the overload taking
loop. A restart, from a changed entry here or fromcontrols.Restart(), plays every pass again.iterationsintThe number of passes, counting the first: Framer Motion's
repeat: nisn + 1here. Zero plays no pass, so no step commits and the sequence reads complete from its mount render on. A count a re-render changes applies to the sequence as it plays, as the Web Animations API'supdateTimingdoes: a count no higher than the passes already finished completes the sequence at the next frame, showing the end state a normal completion holds (the last step current, no skippedCallrun), and a count above them resumes a completed sequence after the repeat gap, at the next pass's step 0. Throws System.ArgumentOutOfRangeException when negative.autoplayboolAs on the overload taking
loop.repeatDelaySecfloatSeconds the cursor waits on the last step between one pass and the next, read as each gap begins. It follows no last pass, so it never delays completion. Throws System.ArgumentOutOfRangeException when negative or not finite.
Returns
- (AnimationSequenceState state, AnimationSequenceControls controls)