Table of Contents

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

steps IReadOnlyList<AnimationSequenceStep>

The ordered sequence. Must not be null.

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. Only read on mount / a deps change, not on every render, 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 never latches.

deps object[]

Unlike UseEffect(Func<Action?>?, object?[]?), omitting this (or passing null) resets the walker on MOUNT ONLY, not on every render — a freshly-built steps array 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)