Interface: SsContext
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:359
One playing animation.
Extends
HybridObject<{android:"c++";ios:"c++"; }>
Properties
advances
readonlyadvances:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:391
Whether update() can change the frame. False for a stopped player, and for a paused one with no effect or instance part: a pause moves only the parts that keep their own clock, and only those two kinds can. Layer 3 sends a player that does not advance no update().
Not isPlaying, which goes false when track 0 finishes: the Brain's clock runs on from play() until stop() or a setup, and the rest of the stack still moves on it — a fade in flight, or a source other than track 0's main one, track 0's own included, still playing where it is heard. So a finished track 0 advances while the Brain says one of those does, and only then. A pause holds them as it holds track 0.
currentAnimationIndex
readonlycurrentAnimationIndex:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:823
Which animation track 0 plays, as an index into getAnimationNames(), or -1 before anything is set up. Follows a track-0 crossfade from the call.
endFrame
readonlyendFrame:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:463
frameDrawn
readonlyframeDrawn:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:376
Whether the last drawInto drew the frame as it stands.
False after anything that changes what would be drawn: an update() that moves the pose, a call that moves the playhead, a new animation, a sub-frame switch, an override, or a track call. An update() that lands on the pose already drawn leaves it true — a frame that lasts several ticks, or a pause, unless an effect or instance part moves on its own clock. A view that finds it true, with the same texture table and transform as last time, can keep the picture it has.
frameNo
readonlyframeNo:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:363
frameRate
readonlyframeRate:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:461
Authored frame rate of the current animation.
generation
readonlygeneration:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:362
isFinished
readonlyisFinished:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:457
True once the configured loops have completed, and it stays true until the next play() / setupAnimation(). A state, not a pulse — take its rising edge to fire a one-shot completion event. Always false on an infinite loop count, and stop() never raises it.
isPausing
readonlyisPausing:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:450
isPlaying
readonlyisPlaying:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:449
Whether the transport is running. Stays true while paused — pausing sets a separate flag. "Actually advancing" is isPlaying && !isPausing.
isPlayingForward
readonlyisPlayingForward:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:492
Which way the playhead is actually travelling this frame — not the same as playbackDirection, which is only the heading that was configured. Under ping-pong the return leg runs backward while playbackDirection still reads forward, and a negative speed does not flip it (a negative speed is a stop).
This is the gate the sibling players put in front of audio: SpriteStudio has no reverse audio, so a key crossed on a backward leg must not be played. A host wiring onAudio into its own audio stack wants the same test.
justLooped
readonlyjustLooped:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:459
True on the frame a loop boundary was crossed.
loopCount
readonlyloopCount:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:476
Configured loop count. -1 is infinite, and it is what you read back for one: setLoopCount normalizes everything at or below zero to -1, so passing 0 asks for infinite but never comes back as 0.
name
readonlyname:string
Defined in: node_modules/.pnpm/nitro-core@0.37.2/node_modules/nitro-core/js/lib/typescript/module/HybridObject.d.ts:52
The HybridObject's name.
Inherited from
HybridObject.name
partCount
readonlypartCount:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:361
passedEventCount
readonlypassedEventCount:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:698
How many events the last update() crossed — user data, signals and all.
A cheap gate in front of getUserDataEvents / getAudioEvents, each of which is otherwise one vector allocation and one Nitro array marshal per player per frame to say "none", on a path that runs 60 times a second for every player on screen. Almost every frame answers 0.
It counts frames crossed that carry any event at all, so it gates both calls and over-reports each: a frame with a user-data key and no audio still makes this non-zero. That is the right direction to be wrong in — the cost of an extra empty read is one marshal, and the cost of a missed one is a dropped event.
playbackDirection
readonlyplaybackDirection:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:479
SsPlaybackDirection wire value.
playbackStyle
readonlyplaybackStyle:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:481
SsPlaybackStyle wire value.
remainingLoops
readonlyremainingLoops:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:477
skipFrames
readonlyskipFrames:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:493
speedScale
readonlyspeedScale:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:469
The speed the Brain stored, which is not always the one that was passed: 0 and negatives clamp to a stop, so a host that dragged a slider negative can see the stop it actually got rather than assuming it got reverse.
startFrame
readonlystartFrame:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:462
subFrame
readonlysubFrame:boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:501
Whether the frame handed to the Brain for display keeps its fraction.
The playhead is a float either way — frameNo reports it unrounded, and the instance / effect slots are always stepped from the unrounded value, since truncating there freezes a child on any tick worth less than a frame.
trackCount
readonlytrackCount:number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:818
How many tracks exist, silent ones included. At least 1 once set up.
Methods
addTrackSource()
addTrackSource(
track,name,weight):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:919
Adds another weighted source to track. The new handle, or -1.
Parameters
track
number
name
string
weight
number
Returns
number
bindInstancePack()
bindInstancePack(
pack):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:406
Makes pack available to this player's Instance parts.
Must be called before setupAnimation, which is when the child players are spawned; a pack bound after that is ignored, and the parts that wanted it stay silently undrawn. The pack identifies itself — its name_hash is read out of the .ssab — so the caller does not have to say which of the names from getExternalInstancePackNames this one satisfies.
Returns false when the pack is already released or the children have been built. Binding the same pack twice is not an error; a pack referenced from several places is loaded once and mounted many times.
Parameters
pack
Returns
boolean
cancelTrackFade()
cancelTrackFade(
track):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:843
Stops the fade on track where it stands.
Parameters
track
number
Returns
boolean
canvasBox()
canvasBox():
SsBox
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:620
The authored canvas of the animation set up — its size, placed against the origin by its pivot — in player-local units. What fit places against when the caller supplies no frame and asks for no measurement.
Read from the .ssab, no bake, so it costs nothing and does not move with the playhead. Zero-sized before an animation is set up.
Returns
cellmapNames()
cellmapNames():
string[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:995
Cellmap names in this pack, without the .ssce extension — the namespace setPartCell hashes against.
Read from the .ssab rather than the texture table, because a cellmap inside an Embedded pack still has a name.
Returns
string[]
cellNames()
cellNames(
cellmapName):string[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:1001
The cell names inside one cellmap — the other half of what setPartCell takes. Empty when the cellmap is not in this pack.
Parameters
cellmapName
string
Returns
string[]
clearPartCell()
clearPartCell(
partIndex):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:789
Parameters
partIndex
number
Returns
boolean
clearPartColor()
clearPartColor(
partIndex):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:774
Parameters
partIndex
number
Returns
boolean
clearPartOverrides()
clearPartOverrides():
boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:792
Drops every per-part override on this player at once.
Returns
boolean
clearPartVisibility()
clearPartVisibility(
partIndex):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:758
Parameters
partIndex
number
Returns
boolean
clearTrack()
clearTrack(
track):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:831
Silences track and cancels its fade. Track 0 cannot be cleared.
Parameters
track
number
Returns
boolean
copyEmbeddedTexture()
copyEmbeddedTexture(
textureHash):ArrayBuffer
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:972
A copy of the encoded image an embedded texture carries, by SsTextureInfo.textureHash, out of the same tree getTextures lists. Empty when that texture is not embedded, or once the context is released.
A copy because the decode runs across an await, which the resource may not outlive. The Brain's own copy stays resident for the resource's whole life either way: it sits inside the same contiguous FlatBuffer as the rest of the pack, so it cannot be freed on its own.
Parameters
textureHash
number
Returns
ArrayBuffer
crossfade()
crossfade(
track,name,durationMs):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:837
Fades track over to name in durationMs — the same unit as update. Everything the track carried fades out together; a fade in flight is folded into the outgoing side where it stands.
Parameters
track
number
name
string
durationMs
number
Returns
boolean
dispose()
dispose():
void
Defined in: node_modules/.pnpm/nitro-core@0.37.2/node_modules/nitro-core/js/lib/typescript/module/HybridObject.d.ts:94
Disposes any resources this HybridObject might hold natively, and releases this HybridObject's NativeState.
After calling (), this object can no longer be used.
Eagerly disposing a HybridObject could be beneficial for a queue-/handler-architecture where a bunch of Hybrid Objects are allocated, and later deallocated once a callback (e.g. a render function) completes.
Returns
void
Note
It is NOT required to call () manually, as the JavaScript Garbage Collector automatically disposes and releases any resources when needed. It is purely optional to eagerly-, and manually-, call () here - use with caution!
Inherited from
HybridObject.dispose
drawInto()
drawInto(
canvas,x,y,scaleX,scaleY):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:1036
Bake and draw the current frame, entirely in C++.
Nothing per-vertex crosses into JS — no SkPoint host objects to allocate and no MakeVertices array to unmarshal. JS is left with one draw call per player per frame.
The root placement is applied here, around the draw: translate by (x, y), then scale by (scaleX, scaleY), a negative scale mirroring that axis. The canvas comes from RN Skia and is borrowed for the call. Draws nothing until setTextures has given it a table. Returns the number of vertices drawn.
Parameters
canvas
x
number
y
number
scaleX
number
scaleY
number
Returns
number
equals()
equals(
other):boolean
Defined in: node_modules/.pnpm/nitro-core@0.37.2/node_modules/nitro-core/js/lib/typescript/module/HybridObject.d.ts:79
Returns whether this HybridObject is the same object as other.
While two HybridObjects might not be equal when compared with ==, they might still hold the same underlying HybridObject, in which case equals(other) will return true.
Parameters
other
HybridObject<{ android: "c++"; ios: "c++"; }>
Returns
boolean
Example
const hybridA = SomeModule.getExistingHybridInstance()
const hybridB = SomeModule.getExistingHybridInstance()
console.log(hybridA.equals(hybridB)) // trueInherited from
HybridObject.equals
fadeTrack()
fadeTrack(
track,targetAlpha,durationMs):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:839
Drives track's alpha to targetAlpha over durationMs.
Parameters
track
number
targetAlpha
number
durationMs
number
Returns
boolean
findPartIndex()
findPartIndex(
partName):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:588
Part index for partName, or -1. Stable for the loaded pack.
Parameters
partName
string
Returns
number
getAnimationNames()
getAnimationNames():
string[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:975
Animation names in this pack, for feeding back to setupAnimation.
Returns
string[]
getAudioEvents()
getAudioEvents():
SsAudioEvent[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:728
The audio keys the last update() crossed.
Same contract as getUserDataEvents in every respect — a read rather than a drain, gated on passedEventCount, and reporting every frame a long update() crossed unless setSkipFrames(true) let it skip. It is a separate call rather than a kind field on one list because the two payloads have nothing in common, and a union would make every consumer narrow before it could read anything.
Each event is resolved against the pack's SoundList here, in C++, because that table lives in the .ssab and the .ssab deliberately never enters the JS heap.
Returns
getLabelTable()
getLabelTable(
animationName):SsLabelTable
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:1004
See SsLabelTable.
Parameters
animationName
string
Returns
getPartQuad()
getPartQuad(
partIndex):SsPartQuad
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:638
Part partIndex's outline on the frame last built — see SsPartQuad. A part with a cell is its four drawn corners, skew and vertex deform included; a Mesh part the axis-aligned box around its vertices; a part with a size and no cell, a Shape, that size around its pivot. Null, bone, Instance and Effect parts have none.
Parameters
partIndex
number
Returns
getPartTransform()
getPartTransform(
partIndex):SsPartTransform
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:629
Where part partIndex is this frame — see SsPartTransform.
Player-local, so the root transform still has to be applied to reach the screen. That is deliberate: the root transform is Layer 2's and is applied exactly once, and folding it in here would give two places that know it.
Parameters
partIndex
number
Returns
getSignalEvents()
getSignalEvents():
SsSignalEvent[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:737
The signals the last update() crossed, inactive ones dropped.
Same contract as the two above, and the third and last table EventsPerFrame carries that is a key rather than a slot — instances and effects are read by their own slot machinery, not here.
Returns
getSourceAnimationIndex()
getSourceAnimationIndex(
source):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:930
Which animation source plays, as an index into getAnimationNames(), or -1 for a handle that names no source.
Parameters
source
number
Returns
number
getSourceEventThreshold()
getSourceEventThreshold(
source):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:934
NaN for a handle that names no source.
Parameters
source
number
Returns
number
getSourceFrame()
getSourceFrame(
source):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:925
NaN for a handle that names no source.
Parameters
source
number
Returns
number
getSourceWeight()
getSourceWeight(
source):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:922
NaN for a handle that names no source.
Parameters
source
number
Returns
number
getTextures()
getTextures():
SsTextureInfo[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:960
Every texture this pack needs, cellmaps first and then external textures.
One list because to a caller it is one question. DrawBatch.texture_hash is the cellmap name's hash normally, but a part under an authored texture change (TCHG) carries the hash of a texture file name out of external_textures instead; miss those and exactly those parts silently stop drawing.
Includes every bound instance pack's textures, deduplicated by hash, so one table covers the whole player tree — which is what drawInto needs, since a child draws through the root's table. Call it aftersetupAnimation: the children do not exist until then, and their textures come with them.
Returns
getTrackAlpha()
getTrackAlpha(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:848
NaN for a track that does not exist.
Parameters
track
number
Returns
number
getTrackBlend()
getTrackBlend(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:852
SsTrackBlend wire value, or -1 for a track that does not exist.
Parameters
track
number
Returns
number
getTrackFadeProgress()
getTrackFadeProgress(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:841
How far the fade in flight on track has got, [0, 1]; NaN when none.
Parameters
track
number
Returns
number
getTrackFrame()
getTrackFrame(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:864
NaN when the track has no animation.
Parameters
track
number
Returns
number
getTrackFrameRate()
getTrackFrameRate(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:878
The rate the track's animation plays at: 0 with no animation and no override, -1 for a track that does not exist.
Parameters
track
number
Returns
number
getTrackLoopCount()
getTrackLoopCount(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:896
-1 forever, 0 for a track with no animation.
Parameters
track
number
Returns
number
getTrackMainSource()
getTrackMainSource(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:917
The handle of the source carrying the track's animation, or -1 when it has none. Released handles are reused, so do not hold one across a fade.
Parameters
track
number
Returns
number
getTrackOutgoingEventThreshold()
getTrackOutgoingEventThreshold(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:911
NaN for a track that does not exist.
Parameters
track
number
Returns
number
getTrackPlaybackDirection()
getTrackPlaybackDirection(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:886
-1 for a track that does not exist.
Parameters
track
number
Returns
number
getTrackPlaybackStyle()
getTrackPlaybackStyle(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:888
-1 for a track that does not exist.
Parameters
track
number
Returns
number
getTrackSkipFrames()
getTrackSkipFrames(
track):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:882
False for a track that does not exist.
Parameters
track
number
Returns
boolean
getTrackSpeed()
getTrackSpeed(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:871
What was stored (a negative speed reads back as 0); NaN for no track.
Parameters
track
number
Returns
number
getTrackSync()
getTrackSync(
track):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:859
SsTrackSync wire value, or -1 for a track that does not exist.
Parameters
track
number
Returns
number
getUserDataEvents()
getUserDataEvents():
SsUserDataEvent[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:712
The user-data keys the last update() crossed.
A read, not a drain: the Brain's collect_events clears its list at the top of each collection, so calling this twice in a tick returns the same events and never calling it loses nothing. That is why it is safe to gate on passedEventCount and on whether anyone is listening.
A long update() can cross several frames at once and reports all of them, unless setSkipFrames(true) let it skip — which is exactly the trade-off that setting exists to make.
Returns
hitTestPart()
hitTestPart(
x,y,parts):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:645
The part on top, in draw order, whose outline holds (x, y) — a point in the space getPartQuad answers in — among parts, or among every part when parts is empty. -1 when none does. Builds no frame.
Parameters
x
number
y
number
parts
number[]
Returns
number
isPartHidden()
isPartHidden(
partIndex):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:664
Whether part partIndex is hidden on the frame being displayed.
The companion to getPartTransform, which reports where a part would be whether or not it is drawn. A host driving its own view from a part needs both: the pose to place it, and this to decide whether to show it — the onHide option the sibling Players offer on their built-in attachments.
Read from the display frame's FrameData — floored when sub-frame is off, the same frame the renderer bakes — so it cannot disagree with what is on screen. It is that frame's hide, which the Brain also sets for a setPartVisibility force-hide and, with cascade, for every descendant it reaches, from the next update() or call that moves the playhead (at once on a player that does not advance — see the override layer below). False for an out-of-range index and before the first update(), when there is no frame to read.
Parameters
partIndex
number
Returns
boolean
isPartSkinnedMesh()
isPartSkinnedMesh(
partIndex):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:682
Whether part partIndex is a skinned mesh — a mesh part bound to bones.
The one thing a follower of getPartTransform has to know. A skinned mesh's vertices are drawn from its bound bones' matrices, while the part's own node transform — what this returns a placement for — stays at its setup position, usually near the character root. So a view pinned to such a part snaps near the root rather than onto the deformed art. A rigid (deform-only) mesh and every non-mesh part place their art at their own node, so those are false and follow correctly.
A static .ssab read, keyed off the same field every sibling Player uses so the answers agree (mesh_binding present with a non-empty influence_bone list). False for an out-of-range index. Available before the first update(), like partNames.
Parameters
partIndex
number
Returns
boolean
isTrackFinished()
isTrackFinished(
track):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:898
True once the track's animation has played its loops out. A state.
Parameters
track
number
Returns
boolean
lastErrorMessage()
lastErrorMessage():
string
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:421
Why the last call that tracks a reason failed, or '' when it succeeded.
The Brain's own wording, not a code. It is for reporting, not for branching: branching would mean hard-coding the integers from SSRuntimeError::as_code, which the C ABI publishes as a compatibility surface but exports no constants for (unlike SS_RUNTIME_TRACK_BLEND_*).
It describes the LAST failure, so read it straight after the call that returned false rather than treating it as a log.
Returns
string
measureContentBox()
measureContentBox(
animations,maxFrames):SsBox
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:610
The box animations actually draw into, measured by baking each of them and unioning every vertex — the subtrees Instance parts mount included.
This is the box a caller asks for when the authored canvas (canvasBox) is not the one it wants: the canvas is where the artist composed, and art can overflow it.
Moves the playhead and leaves the last of animations set up, so it runs before setupAnimation — the same ordering rule bindInstancePack has, and for a related reason: it is load-time setup, not a query. Layer 3 already calls setAnimation after a load, which restores the intended one.
maxFrames caps the walk per animation; 0 means one authored cycle. An effect's extent grows for as long as it is simulated, so a pack of those wants a real cap rather than a cycle.
Returns a zero-sized box when nothing drew — a caller should fall back to placing at scale 1 rather than dividing by it.
Parameters
animations
string[]
maxFrames
number
Returns
partNames()
partNames():
string[]
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:986
Part names in part-index order, read from the .ssab and so available before the first update().
A part authored without a name holds its slot as '' rather than being skipped, so the list stays aligned with the partIndex every event carries — turning one back into something a human reads is the point. length is the part count, which partCount reports only once a frame has run.
Returns
string[]
pause()
pause():
void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:519
Holds playback on the current frame, and does nothing if already held or if nothing is playing.
Maps onto ss_runtime_pause, which is one-way and idempotent: a toggle would make a second call from a declarative playing prop resume.
Returns
void
play()
play():
void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:509
Starts from the beginning — not a resume. ss_runtime_play rewinds to the start frame (the end frame when playing backwards), re-arms the loop counter and clears the pause and terminal flags. To carry on from where a pause left off, use resume(). Moves the playhead.
Returns
void
playFrom()
playFrom(
frameNo):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:511
As play(), but starting at frameNo. Moves the playhead.
Parameters
frameNo
number
Returns
void
resume()
resume():
void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:524
Lifts a pause(), carrying on from the same frame. Does nothing if not held. Not the same as play(), which heads out and rewinds.
Returns
void
setFrameNo()
setFrameNo(
frameNo):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:531
Seeks without changing play/pause state. Moves the playhead.
Parameters
frameNo
number
Returns
void
setFrameRate()
setFrameRate(
fps):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:577
Overrides the advance rate, in absolute frames per second.
The host's rather than the clip's, so it survives setupAnimation — pass 0 (or a negative) to clear it and go back to whatever each animation was authored at. setSpeedScale is the multiplier; this replaces the rate.
Parameters
fps
number
Returns
void
setLoopCount()
setLoopCount(
loops):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:540
How many times to play: n cycles then stop, -1 forever, and 0 asks for the same as -1 rather than "no cycles".
The one transport setting that is per-transition: setupAnimation resets it, so a host that wants a count to hold has to set it again after each switch.
Parameters
loops
number
Returns
void
setPartCell()
setPartCell(
partIndex,cellmapNameHash,cellNameHash,priority):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:783
Swaps which cell a part samples — a costume change, or a mouth shape.
Both hashes come from hashString, of the cellmap name (no .ssce) and the cell name. Normal and Mask parts only; fails if the cell cannot be resolved, which is what makes a typo visible rather than silent.
Parameters
partIndex
number
cellmapNameHash
number
cellNameHash
number
priority
number
Returns
boolean
setPartColor()
setPartColor(
partIndex,blendOp,rgba,priority):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:768
rgba is 0xRRGGBBAA and fills all four corners. blendOp is the PartColor blend — 0=Mix 1=Mul 2=Add 3=Sub, and only those four — not DrawBatch.blend_type's twelve. Conflating the two is a mistake.
priority: 0 until the next keyframe, 1 until the next animation, 2 permanent.
Parameters
partIndex
number
blendOp
number
rgba
number
priority
number
Returns
boolean
setPartVisibility()
setPartVisibility(
partIndex,force,cascade):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:757
force: 0 reverts to the animation, 1 force-hides. 2 (force-show) is reserved: the runtime rejects it and returns false. cascade propagates a force-hide to descendants, which is what "hide this limb" almost always means.
Parameters
partIndex
number
force
number
cascade
boolean
Returns
boolean
setPlaybackDirection()
setPlaybackDirection(
direction,style):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:556
Which way the playhead walks, and what it does at the far end.
Survives setupAnimation — "play this backwards" describes the playback, not the clip that happens to be loaded. The heading inside a ping-pong cycle does not: a new animation always starts on the outward leg.
Parameters
direction
number
style
number
Returns
void
setSection()
setSection(
startFrame,endFrame):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:569
Restricts playback to [startFrame, endFrame], both ends included. An end out of the animation's range is its edge on that side. Moves the playhead.
Returns false, changing nothing, when both ends are in range and the end is before the start; lastErrorMessage then says why.
Parameters
startFrame
number
endFrame
number
Returns
boolean
setSkipFrames()
setSkipFrames(
skip):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:561
Whether a long update() may skip intermediate frames. False makes every frame — and so every event on it — observed, at the cost of catching up.
Parameters
skip
boolean
Returns
void
setSourceEventThreshold()
setSourceEventThreshold(
source,threshold):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:932
The weight at or above which source fires events. Default +∞.
Parameters
source
number
threshold
number
Returns
boolean
setSourceFrame()
setSourceFrame(
source,frameNo):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:923
Parameters
source
number
frameNo
number
Returns
boolean
setSourceWeight()
setSourceWeight(
source,weight):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:920
Parameters
source
number
weight
number
Returns
boolean
setSpeedScale()
setSpeedScale(
rate):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:548
Multiplier on the authored frame rate.
0 stops the playhead where it stands rather than meaning "no setting", and a negative rate is clamped to the same stop — reversing is setPlaybackDirection's job, not the speed's. Survives setupAnimation.
Parameters
rate
number
Returns
void
setSubFrame()
setSubFrame(
enabled):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:585
See subFrame. Off floors the display frame only, pinning playback to whole authored frames; the playhead and the slot stepping are untouched.
Propagates to the instance children, which are drawn at their own playhead and have to be floored on the same terms.
Parameters
enabled
boolean
Returns
void
setTextures()
setTextures(
textures):void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:1021
The texture table drawInto resolves batches against, kept until the next call. Set it when the table changes, not every frame: it is an array marshalled across JSI.
It resolves each batch's texture_hash to the paint it draws with, so a pack with several cellmaps still costs one drawInto and — unlike drawing per texture — keeps the batches in the order the Brain emitted them, which is the whole of the depth sorting. A batch whose hash is absent is skipped rather than drawn with the wrong atlas.
The context holds a reference to every paint until the table is replaced or the context disposed, so a registry that drops a paint meanwhile leaves nothing dangling.
Parameters
textures
Returns
void
setTrackAlpha()
setTrackAlpha(
track,alpha):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:846
How strongly track layers onto the pose below. Not clamped.
Parameters
track
number
alpha
number
Returns
boolean
setTrackAnimation()
setTrackAnimation(
track,name):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:829
Lays name on track, replacing what it played. Tracks grow on demand; track 0 must have been set up first. Cancels a fade in flight on the track.
Parameters
track
number
name
string
Returns
boolean
setTrackBlend()
setTrackBlend(
track,blend):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:850
SsTrackBlend wire value: 0 Mix, 1 Additive.
Parameters
track
number
blend
number
Returns
boolean
setTrackFrame()
setTrackFrame(
track,frameNo):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:862
Seeks the track's main animation.
Parameters
track
number
frameNo
number
Returns
boolean
setTrackFrameRate()
setTrackFrameRate(
track,fps):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:873
Absolute fps override; 0 or less clears it. A track setting.
Parameters
track
number
fps
number
Returns
boolean
setTrackLoopCount()
setTrackLoopCount(
track,loops):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:894
How many times the track's animation plays before it holds its last frame; 0 or less loops forever. The animation's, not the track's: laying another one on the track starts it looping forever again.
Parameters
track
number
loops
number
Returns
boolean
setTrackOutgoingEventThreshold()
setTrackOutgoingEventThreshold(
track,threshold):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:909
How far into a crossfade on track its outgoing side keeps firing events: while its share, 1 - t, is at least threshold. Default +∞, silent from the moment the fade begins.
Parameters
track
number
threshold
number
Returns
boolean
setTrackPlaybackDirection()
setTrackPlaybackDirection(
track,direction,style):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:884
Wire values as setPlaybackDirection. A track setting.
Parameters
track
number
direction
number
style
number
Returns
boolean
setTrackSkipFrames()
setTrackSkipFrames(
track,skip):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:880
A track setting.
Parameters
track
number
skip
boolean
Returns
boolean
setTrackSpeed()
setTrackSpeed(
track,speed):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:869
The track's speed — a track setting, so it holds for every animation laid on the track, a crossfade's both sides included. Track 0's is speedScale.
Parameters
track
number
speed
number
Returns
boolean
setTrackSync()
setTrackSync(
track,sync):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:857
SsTrackSync wire value: 0 Free, 1 Start. Set it before laying an animation; a track with nothing on it is created for it.
Parameters
track
number
sync
number
Returns
boolean
setupAnimation()
setupAnimation(
name):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:408
Parameters
name
string
Returns
boolean
stop()
stop():
void
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:529
Halts the transport where it stands — it does not rewind, and it does not raise isFinished. play() is what returns to the start.
Returns
void
toString()
toString():
string
Defined in: node_modules/.pnpm/nitro-core@0.37.2/node_modules/nitro-core/js/lib/typescript/module/HybridObject.d.ts:64
Returns a string representation of the given HybridObject.
Unless overridden by the HybridObject, this will return the name of the object.
Returns
string
Example
const hybridA = SomeModule.getExistingHybridInstance()
console.log(hybridA.toString()) // [HybridObject HybridA]Inherited from
HybridObject.toString
trackJustLooped()
trackJustLooped(
track):boolean
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:903
True for the update in which the track's animation wrapped. A pulse, and the Brain's own: it stands until the next update, however long that is.
Parameters
track
number
Returns
boolean
update()
update(
dtMilliseconds):number
Defined in: packages/react-native-spritestudio/src/specs/SsRuntime.nitro.ts:432
Advances by dtMilliseconds and returns the new frame number. Invalidates every previously issued buffer.
Milliseconds, which is what ss_runtime_update takes, and the unit every layer above uses too — a seconds-shaped API here would put a * 1000 at the seam and a silent 1000x slowdown one forgotten conversion away. It is the same unit as ss_runtime_crossfade's duration.
Parameters
dtMilliseconds
number
Returns
number