Skip to content

aninest root / AnimatableEvents / addRecursiveListener

addRecursiveListener()

ts
function addRecursiveListener<Animating>(
   anim, 
   type, 
   listener, 
   options): unsubscribe

Adds a recursive start listener to the animation. This listener will trigger on any child modification. Animation listeners are called in the order in which they were added.

Type Parameters

Animating extends RecursiveAnimatable<unknown>

Parameters

anim: Animation<Animating>

type: AnimatableEvents

listener: Listener<undefined> | Listener<UnknownAnimation>

() => boolean Returns whether to remove the listener. Void or false to keep the listener.

options = {}

Contains one option, signal which supports passing in an AbortSignal.

options.signal?: AbortSignal

Returns

unsubscribe

A function to remove the listener

Example

ts
const anim = createAnimation({ a: newVec2(0, 0), b: newVec(0, 0) }, getLinearInterp(1))
addRecursiveListener(anim, "start", () => console.log("started")) // will trigger

Defined in

Animate/AnimatableEvents.ts:126