# AnimationEndEvent

> Talos 0.7 · Since 0.6; changed in 0.7

`data` of the event a one-shot raises when it ends: `"animation-end"` unless it names its own.

## Signature

```ts
export interface AnimationEndEvent {
  /** Id of the entity whose animator it was. */
  entity: string
  /** The one-shot: a state name, or a clip name when {@link Animator.play} was given a clip. */
  state: string
  /** The clip it was playing. */
  clip: string
  /** The state that took over. */
  next: string
  /** True when something cut it short rather than the clip running out. */
  interrupted: boolean
  /** The animator layer it played on; absent for the base state machine. */
  layer?: string
}
```

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

## Members

| Member | Signature | Description |
|---|---|---|
| `entity` | `entity: string` | Id of the entity whose animator it was. |
| `state` | `state: string` | The one-shot: a state name, or a clip name when {@link Animator.play} was given a clip. |
| `clip` | `clip: string` | The clip it was playing. |
| `next` | `next: string` | The state that took over. |
| `interrupted` | `interrupted: boolean` | True when something cut it short rather than the clip running out. |
| `layer` | `layer?: string` | The animator layer it played on; absent for the base state machine. |

## Example

The tested fixture `fixtures/app/agent.ts`.

```ts
import type { Behavior } from "@argus/api"

// Sends a nav agent to `props.target` once, then reports arrival through ctx.state so the
// test can read it without polling the crowd directly.
export default {
  init(ctx) {
    ctx.state.arrived = false
    ctx.nav?.goTo(ctx.props.target as [number, number, number])
  },
  update(ctx) {
    if (ctx.nav?.arrived) ctx.state.arrived = true
  },
} satisfies Behavior
```
