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 }
local sent = anim.Play('drink', { loop = false, durationMs = 4000, cancelable = false }, 'mymodule')
if not sent.ok then print(sent.error) endPlay options
- variant?:
integer— default: the first offered - clip?:
string— engine clip name, instead ofvariant - loop?:
boolean— defaultLOOP_BY_DEFAULT;falseplays once forONE_SHOT_MSunlessdurationMsis given - durationMs?:
integer— 1000..MAX_DURATION_MS; default none - cancelable?:
boolean— defaulttrue;falseblocks/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; otherwiseunknown_category
Returns
Result—{ animations = { listing, … } }, each listing:name,label,category,categoryLabel,prop,placementkind:'layer'keeps the player walking,'workspot'holds them stillplatform:truefor a profile read from the platform,falsefor a written rowvariants:{ { 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 }; errorsinvalid_player,presentation_unavailable
OpenPicker
anim.OpenPicker(category)Parameters
- category?:
string
Returns
Result—{ queued = true }
ClosePicker
anim.ClosePicker()Returns
Result—{ queued = true }; errorpicker_not_openif none is up