Talos docs

AnimatorPlayOptions

Since 0.6

How a one-shot started by {@link Animator.play} leaves.

Plain text

Every field mirrors once on a scene state.

Signature

export interface AnimatorPlayOptions {
  /** The state entered when the clip ends. Default: the state that was playing before. */
  then?: string
  /** Seconds to blend in. Default: the blend of the transition that reaches the state, else 0.2. */
  blend?: number
  /** Seconds before the clip's last frame the hand-over starts, and how long it blends. Default 0.2. */
  blendOut?: number
  /** The states that may cut it short. Default: any. `[]`: none — it always plays to the end. */
  interrupt?: string[]
  /** The bus event raised when it ends. Default `"animation-end"`. */
  event?: string
}

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

Members

MemberSignatureDescription
thenthen?: stringThe state entered when the clip ends. Default: the state that was playing before.
blendblend?: numberSeconds to blend in. Default: the blend of the transition that reaches the state, else 0.2.
blendOutblendOut?: numberSeconds before the clip's last frame the hand-over starts, and how long it blends. Default 0.2.
interruptinterrupt?: string[]The states that may cut it short. Default: any. []: none — it always plays to the end.
eventevent?: stringThe bus event raised when it ends. Default "animation-end".

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