Skip to content

Documentation / @ripl/charts / transitionIfAny

Function: transitionIfAny() ​

transitionIfAny<TElement>(renderer, elements, options?): Promise<unknown>

Defined in: charts/src/core/animation.ts:93

Runs a transition over the given elements, resolving immediately when there are none. An empty renderer.transition still starts the animation loop and only settles a frame later, so the guard keeps a render with nothing to animate free.

Type Parameters ​

Type ParameterDescription
TElement extends Element<Partial<BaseState>, ElementEventMap>The element type being transitioned.

Parameters ​

ParameterTypeDescription
rendererRendererThe renderer running the transition.
elementsTElement | TElement[] | null | undefinedThe element(s) to transition; an empty array, null or undefined is a no-op.
options?RendererTransitionOptionsArg<TElement>Transition options, or a factory resolving them per element.

Returns ​

Promise<unknown>

A promise settling when the transition completes.