Skip to content

aninest-root / AnimatableEvents / removeRecursiveListener

removeRecursiveListener()

ts
function removeRecursiveListener<Animating>(
   anim, 
   type, 
   listener): void;

Defined in: Animate/AnimatableEvents.ts:216

Removes a recursive start listener from the animation

Type Parameters

Animating

Animating extends Animatable<unknown>

Parameters

anim

Animation<Animating>

type

"beforeStart" | "immutableStart" | "start" | "end" | "interrupt" | "beforeEnd"

listener

Listener<Animation<Animatable<LocalAnimatable>>>

Returns

void

Example

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

modifyTo(anim.children.a, {x: 1}) // will trigger the listener

removeRecursiveListener(anim, "start", listener)
modifyTo(anim.children.a, {x: 0}) // will not trigger the listener

Deprecated

Instead use the return value of {@link addRecursiveListener} or the AbortSignal passed into {@link addRecursiveListener} with the options' signal field.