AnimationEndEvent
Since 0.6
data of the event a one-shot raises when it ends: "animation-end" unless it names its own.
Signature
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
}
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. |
Example
The tested fixture fixtures/app/agent.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