Table of Contents

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

steps IReadOnlyList<AnimationSequenceStep>

The ordered sequence. Must not be null.

deps object[]

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.

autoplay bool

Starts advancing on mount when true (default). When false, call controls.Play() — e.g. from an onClick handler — to start it on demand. Read only where deps restarts the sequence, so a later controls.Pause() is not fought by a re-render that keeps passing autoplay: true.

loop bool

When true, the cursor wraps to step 0 after the last step's hold elapses and IsComplete latches only for an empty steps list.

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

steps IReadOnlyList<AnimationSequenceStep>

The ordered sequence. Must not be null.

deps object[]

As on the overload taking loop. A restart, from a changed entry here or from controls.Restart(), plays every pass again.

iterations int

The number of passes, counting the first: Framer Motion's repeat: n is n + 1 here. 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's updateTiming does: 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 skipped Call run), 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.

autoplay bool

As on the overload taking loop.

repeatDelaySec float

Seconds 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)