# SpriteAnimationEndEvent

> Talos 0.7 · Since 0.6

`data` of the event a non-looping sprite animation raises when it ends.

## Signature

```ts
export interface SpriteAnimationEndEvent {
  /** Id of the entity whose sprite it was. */
  entity: string
  /** The animation that ended. */
  animation: string
  /** The animation that took over (`then`), or null. */
  next: string | null
}
```

Import: `import type { SpriteAnimationEndEvent } from "@argus/api"`

## Members

| Member | Signature | Description |
|---|---|---|
| `entity` | `entity: string` | Id of the entity whose sprite it was. |
| `animation` | `animation: string` | The animation that ended. |
| `next` | `next: string \| null` | The animation that took over (`then`), or null. |

## Example

The tested fixture `fixtures/host/door.ts`.

```ts
import type { Behavior } from "@argus/api"
// docs/API.md, "Joints": a door on a hinge that swings open while the player is near and closes
// behind them. Typechecked by packages/api's tests.
export default {
  update(ctx) {
    const player = ctx.world.find("player")
    const near = player !== null && ctx.entity.distanceTo(player) < 2
    ctx.joint?.setMotor(near ? Math.PI / 2 : 0, { mode: "position", maxForce: 200 })
  },
} satisfies Behavior
```
