aninest-root / AnimatableEvents / addRecursiveListener
addRecursiveListener()
ts
function addRecursiveListener<Animating>(
anim,
type,
listener,
options): unsubscribe;
Defined in: Animate/AnimatableEvents.ts:168
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
Animating
extends Animatable
<unknown
>
Parameters
anim
Animation
<Animating
>
type
listener
() => boolean Returns whether to remove the listener. Void or false to keep the listener.
Listener
<undefined
> | Listener
<UnknownAnimation
>
options
Contains one option, signal
which supports passing in an AbortSignal.
signal?
AbortSignal
Returns
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