OPX//77
opx_infinityanimations

Client

Last updated on

The animations contract on the client — play, stop and list animations on the local player.

local anim = OPX.Api.Get('animations')

From client code inside opx_infinity. Every function answers a Result and does not yield; one that raises answers internal_error.

Play

Sends a play request. The server's verdict arrives on opx:on:animations:result with the same requestId.

anim.Play(name, options, owner)

Parameters

  • name: string
  • options?: table — see Play options
  • owner?: string
    • Your module id: the animation stops when that module stops, and the owner may stop or replace its own locked animation.

Returns

  • Result — { queued = true, requestId, animation, variant }
Example
local sent = anim.Play('drink', { loop = false, durationMs = 4000, cancelable = false }, 'mymodule')
if not sent.ok then print(sent.error) end

Play options

  • variant?: integer — default: the first offered
  • clip?: string — engine clip name, instead of variant
  • loop?: boolean — default LOOP_BY_DEFAULT; false plays once for ONE_SHOT_MS unless durationMs is given
  • durationMs?: integer — 1000..MAX_DURATION_MS; default none
  • cancelable?: boolean — default true; false blocks /opx.anim.stop, the stop key and other plays until it ends. Needs a duration (or a non-looping play).

Stop

Stops the local player's animation. Refused with animation_locked while a non-cancelable one runs, unless owner started it.

anim.Stop(owner)

Parameters

  • owner?: string

Returns

  • Result — { queued, requestId? }

List

anim.List(category)

Parameters

  • category?: string — one of the twelve families; otherwise unknown_category

Returns

  • Result — { animations = { listing, … } }, each listing:
    • name, label, category, categoryLabel, prop, placement
    • kind: 'layer' keeps the player walking, 'workspot' holds them still
    • platform: true for a profile read from the platform, false for a written row
    • variants: { { variant, clip, words } }

Categories

anim.Categories()

Returns

  • Result — { categories = { { name, label, count } } } — the twelve families in picker order

Get

anim.Get(name)

Parameters

  • name: string

Returns

  • Result — { animation = listing } (as in List)

State

What a player is playing, as seen by this client.

anim.State(playerId)

Parameters

  • playerId?: number — default: you

Returns

  • Result — { active, playbackId?, animation?, clip?, variant?, known?, step?, steps?, cycle?, presenting }; errors invalid_player, presentation_unavailable

OpenPicker

anim.OpenPicker(category)

Parameters

  • category?: string

Returns

  • Result — { queued = true }

ClosePicker

anim.ClosePicker()

Returns

  • Result — { queued = true }; error picker_not_open if none is up

On this page