dropAnimationPlayer

View sourcedropAnimationPlayer(entity: EntityHandle, world: World): void

Releases the live handles retained by an AnimationPlayer component.

Register this function as the component’s remove callback. It looks up the player with World#get; if no player is found, it returns without changing anything. Otherwise, it calls drop() on every retained handle, then clears both handles and animations. It does not remove the component or update current.

Examples

import { ComponentHooks, World } from '@wimaengine/ecs'
import { AnimationPlayer, dropAnimationPlayer } from '@wimaengine/animation'

const world = new World()
world.setComponentHooks(
  AnimationPlayer,
  new ComponentHooks(null, dropAnimationPlayer)
)

const entity = world.spawn([new AnimationPlayer()])
world.remove(entity, [AnimationPlayer])
// Removing the component also releases its retained handles.

Parameters

NameDescriptionDefault
entity

Entity whose player component is being removed.

—
world

World that owns the entity.

—