Class: SpriteStudioPlayer
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:214
Layer 3 — the user-facing player: transport, clock and events.
Externally clocked by default. advance(dt) is the drive, called by <SpriteStudioView> from its frame loop, so the whole tree ticks off one clock instead of N. startClock() exists for headless use, where there is no view to do it.
Everything below advance/draw is Layer 2's; everything above is React's. This layer holds the resource, applies transport settings that were set before a load finished, and turns the Brain's isFinished state into a one-shot event.
Implements
Constructors
Constructor
new SpriteStudioPlayer(
options?):SpriteStudioPlayer
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:353
Parameters
options?
Returns
SpriteStudioPlayer
Properties
onAnimationChanged
onAnimationChanged:
SsAnimationCallback|null=null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:323
Fires when a different animation is mounted, with the new name.
Not on a re-setAnimation to the same name, which is a restart and reports itself through onAnimationStarted.
animation is a prop, so a re-render can mount a different clip without anything in the host calling setAnimation at all — the switch happens in applySettings, below Layer 4. Without this there is no way to observe it.
onAnimationFinished
onAnimationFinished:
SsAnimationCallback|null=null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:300
Fires on the rising edge of the Brain's isFinished, so once per run.
onAnimationLooped
onAnimationLooped:
SsAnimationCallback|null=null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:302
Fires on any frame the playhead crossed a loop boundary.
onAnimationStarted
onAnimationStarted:
SsAnimationCallback|null=null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:311
Fires when playback starts from the beginning — not on resume.
Layer 3 folds start and resume into one play() verb because that is what a playing prop means, but they are different events: one rewinds and re-arms the loop counter, the other carries on. This is the first of the two, which is the one worth reacting to.
onAudio
onAudio: ((
event) =>void) |null=null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:338
Fires once per audio key the playhead crossed, in advance.
Gated exactly like onUserData, and for the same reason. Nothing plays it: the event says what to play and where the file is, and an app that leaves this null gets a silent animation rather than an error.
onSignal
onSignal: ((
event) =>void) |null=null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:345
Fires once per active signal the playhead crossed, in advance.
Gated like the other two. Nothing here interprets commandId — dispatching it is the whole point, and is the app's.
onUserData
onUserData: ((
event) =>void) |null=null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:330
Fires once per user-data key the playhead crossed, in advance.
Only read from Layer 1 when something is listening — the Brain rebuilds its list every collection, so a tick nobody watched costs nothing.
textures
readonlytextures:SsTextureRegistry
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:349
Accessors
advances
Get Signature
get advances():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:2013
Whether advance can change the frame. See SsContext.advances.
Returns
boolean
canvasBox
Get Signature
get canvasBox():
SsBox|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1892
The animation's authored canvas, placed against the origin by its pivot, in player-local units: what fit places against when the caller supplies no frame and asked for no measurement. Null until an animation is set up.
Returns
SsBox | null
contentBox
Get Signature
get contentBox():
SsBox|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1883
The box the art occupies, in player-local units, or null when nothing has been measured. What fit places against when present.
Null is not a failure — it is what a player loaded without a measure request reports, and Layer 4 falls back to canvasBox.
Returns
SsBox | null
currentAnimation
Get Signature
get currentAnimation():
string|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:606
Returns
string | null
Implementation of
SpriteStudioPlayerApi.currentAnimation
endFrame
Get Signature
get endFrame():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1072
Returns
number
frameNo
Get Signature
get frameNo():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:609
Returns
number
Implementation of
frameRate
Get Signature
get frameRate():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:651
Returns
number
frameSkipEnabled
Get Signature
get frameSkipEnabled():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1051
See setFrameSkipEnabled.
Returns
boolean
internal
Get Signature
get internal():
SsInternalPlayer|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:596
The Layer 2 player, or null before the first successful load.
Returns
SsInternalPlayer | null
isFinished
Get Signature
get isFinished():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:615
Returns
boolean
Implementation of
SpriteStudioPlayerApi.isFinished
isLoaded
Get Signature
get isLoaded():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:600
Returns
boolean
isPausing
Get Signature
get isPausing():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:620
Whether playback is held by pause. Stays false before the first play.
Returns
boolean
isPlaying
Get Signature
get isPlaying():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:612
Returns
boolean
Implementation of
SpriteStudioPlayerApi.isPlaying
isPlayingForward
Get Signature
get isPlayingForward():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:648
Which way the playhead is actually travelling this frame.
Not playbackDirection, which is only the heading that was configured: under ping-pong the return leg runs backward while the configured heading still reads forward. Gate audio on this — SpriteStudio has no reverse audio, so a key crossed on a backward leg is not meant to sound, and it is the test the players that do play audio themselves apply.
player.onAudio = (e) => {
if (player.isPlayingForward) mySoundBank.play(e.soundName, e.loopNum)
}Returns
boolean
Whether the playhead is travelling forward this frame. Gate audio on it.
Implementation of
SpriteStudioPlayerApi.isPlayingForward
justLooped
Get Signature
get justLooped():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:630
Whether the last advance crossed a loop boundary. A pulse, true only inside the tick that crossed — take onAnimationLooped instead if you would rather have it delivered than polled. False after a tick that did not run. Track 0's trackJustLooped.
Returns
boolean
lastTextureReport
Get Signature
get lastTextureReport():
SsTextureLoadReport|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:552
What the last load could not resolve, or null before the first one.
Worth surfacing because a missing texture is silent: drawInto skips a batch it has no paint for, so the symptom is a part that is simply not there rather than an error.
Returns
SsTextureLoadReport | null
Set Signature
set lastTextureReport(
value):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:555
Parameters
value
SsTextureLoadReport | null
Returns
void
loopCount
Get Signature
get loopCount():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1046
Cycles configured for this run; 0 and -1 are both infinite.
Returns
number
needsDraw
Get Signature
get needsDraw():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:2005
Whether draw would draw something other than what it last drew. False for a stopped player whose frame, textures and placement are as they were, so a view can keep the picture it has.
Returns
boolean
partCount
Get Signature
get partCount():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:654
Returns
number
playbackDirection
Get Signature
get playbackDirection():
SsPlaybackDirection
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1059
The heading that was configured — not isPlayingForward, which is where the playhead is actually going this frame.
Returns
playbackStyle
Get Signature
get playbackStyle():
SsPlaybackStyle
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1064
What the playhead does at the far end of the section.
Returns
rootTransform
Get Signature
get rootTransform():
SsRootTransform|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1924
Where the origin lands and how it is scaled/mirrored. Held here as well as on Layer 2 so it can be set before a load and survive one.
Returns
SsRootTransform | null
speedScale
Get Signature
get speedScale():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1041
Multiplier in effect, read back from the Brain rather than from what was asked for. 0 and negatives clamp to a stop there, so setting -2 and reading this back gives 0 — the stop it actually became, not the reverse playback the request looks like. Falls back to the pending setting before a resource exists.
Returns
number
startFrame
Get Signature
get startFrame():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1069
First and last frame of the range being played — the section once one is set.
Returns
number
subFrameEnabled
Get Signature
get subFrameEnabled():
boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1030
See setSubFrameEnabled.
Returns
boolean
textureCacheKeys
Get Signature
get textureCacheKeys():
string[]
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:591
Atlas cache keys the last load leased — what ssPreload retains so its throwaway player's dispose does not evict the very entries it warmed.
Returns
string[]
totalFrames
Get Signature
get totalFrames():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1077
Frames in that range, both ends inclusive. Feed it to a scrubber.
Returns
number
trackCount
Get Signature
get trackCount():
number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1353
Tracks that exist, silent ones included. 0 before a load.
Returns
number
Methods
addListener()
addListener(
listener): () =>void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:2065
Subscribes to load/transport changes. Returns the unsubscribe.
Parameters
listener
() => void
Returns
() => void
addTrackSource()
addTrackSource(
track,name,weight?):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1624
Adds name to track as another weighted source — locomotion-style blending within one track — and returns its handle, or null when it was refused. weight only sets proportions among the track's sources.
Parameters
track
number
name
string
weight?
number = 1
Returns
number | null
advance()
advance(
dtMilliseconds):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1952
Advances the animation and dispatches the frame's events.
A stopped player (never played, stopped, or finished) holds its frame: nothing advances, its parts with independent playback included, as in SSPlayerForWeb. A paused one still advances, so those keep running, unless it has no effect or instance part, in which case nothing could move. A finished one still advances while the rest of the stack moves the pose: track 0 ending does not stop the clock that runs on — see SsContext.advances.
isFinished is a state the Brain latches until the next play/setup, so onAnimationFinished is fired off its rising edge — polling the state itself would fire it on every frame after the end.
Parameters
dtMilliseconds
number
Returns
void
Implementation of
cancelTrackFade()
cancelTrackFade(
track):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1429
Stops the fade on track where it stands; the next crossfade takes what it left.
Parameters
track
number
Returns
boolean
cellmapNames()
cellmapNames():
string[]
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:697
Cellmap names in the pack, without the .ssce extension — the namespace a cell override takes. Empty before a load completes.
Returns
string[]
cellNames()
cellNames(
cellmapName):string[]
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:702
The cell names inside one cellmap — the other half a cell override takes.
Parameters
cellmapName
string
Returns
string[]
clearTrack()
clearTrack(
track):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1377
Silences track and cancels its fade. Track 0 cannot be cleared — fade it instead.
Parameters
track
number
Returns
boolean
crossfade()
crossfade(
track,name,durationMs):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1401
Fades track over to name in durationMs (the unit advance takes). Everything the track carries fades out together, and a crossfade started while one runs takes the pose over where it stands.
On track 0 the incoming animation takes over from the call on: currentAnimation, isPlaying / isFinished / justLooped, the frame, the events and the discrete attributes (cells, hiding, part colour) all belong to it at once, and the outgoing one only fades away — it no longer reports finishing, and by default fires no events (setTrackOutgoingEventThreshold). onAnimationChanged fires, onAnimationStarted does not: it is a switch, not a play(). The incoming animation plays at the track's speed, direction, frame rate and frame skip, and loops setLoopCount times; it starts from its head.
Fades run on the playback clock, so on a paused or stopped player the fade waits for resume or play.
Parameters
track
number
name
string
durationMs
number
Returns
boolean
dispose()
dispose():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:2117
Releases every native handle. Explicit, never left to GC — the lifetime rule in specs/SsRuntime.nitro.ts. Idempotent.
Returns
void
draw()
draw(
canvas):number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:2019
Draws the current frame. Returns the number of vertices drawn.
Parameters
canvas
Returns
number
fadeTrack()
fadeTrack(
track,alpha,durationMs):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1413
Drives track's alpha to alpha over durationMs. Fading track 0 to 0 brings the character to its setup pose.
Parameters
track
number
alpha
number
durationMs
number
Returns
boolean
findPartIndex()
findPartIndex(
partName):number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:659
Resolve a part name to its index, or -1 when the name is not in the animation.
Parameters
partName
string
Returns
number
getAnimationNames()
getAnimationNames():
string[]
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:707
See SpriteStudioPlayerApi. Empty before a load completes.
Returns
string[]
Implementation of
SpriteStudioPlayerApi.getAnimationNames
getCellmapTexture()
getCellmapTexture(
name):SkImage|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1856
The runtime replacement in effect for name, or null when none is — the override value only, never the pack's own texture. Use it to read back what setCellmapTexture set.
Parameters
name
string
Returns
SkImage | null
getLabelTable()
getLabelTable(
animation?):SsLabelTable|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:973
The labels of animation — the current one when omitted — in frame order, with the animation's own first and last frame. Null before a load and for an animation the pack does not have. Read from the pack on every call, so hold the table rather than asking per frame.
Parameters
animation?
string
Returns
SsLabelTable | null
getPartQuad()
getPartQuad(
part):SsPartQuad|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1201
The outline part is drawn with on the frame last built, in view pixels — the root transform applied, so the space a touch on the view reports, unlike getPartTransform. Null before a load, for an unknown or hidden part, and for a part that draws nothing of its own.
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 Shape its size around its pivot. Null, bone, Instance and Effect parts have none, and a part drawn at alpha 0 still has one.
Parameters
part
string | number
Returns
SsPartQuad | null
getPartTransform()
getPartTransform(
part):SsPartTransform|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1127
Where a part is this frame, in player-local units, or null if it has no matrix — an unknown name, or a frame before the first advance.
Player-local: rootTransform still has to be applied to reach the screen, and useSsPartTransform is what does that.
Position, rotation and scale only. A part's Skew is a non-inheriting local-vertex deform, so it never enters the world matrix this decomposes: a followed part — or one under a sheared parent — is reported unsheared, matching SpriteStudio, where Skew does not inherit to children.
Parameters
part
string | number
Returns
SsPartTransform | null
getReplaceableTextureNames()
getReplaceableTextureNames():
string[]
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1870
Every texture a setCellmapTexture can target — cellmap names, without .ssce, followed by the external-texture file names a TCHG points at, deduplicated. Empty before a load completes.
The external names are here because a TCHG binds through them, so they are legitimately replaceable too — the list a UI would offer as "textures you can swap". It is a snapshot of the loaded pack, cached from the last load rather than re-read per call.
Returns
string[]
hitTestPart()
hitTestPart(
x,y,parts?):number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1231
The index of the part on top whose getPartQuad outline holds (x, y), a point in view pixels, among parts — names or indices, every part when omitted — on the frame last built. -1 when none does, as findPartIndex answers; a name the animation does not have is skipped.
Parameters
x
number
y
number
parts?
readonly (string | number)[]
Returns
number
isPartHidden()
isPartHidden(
part):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1156
Whether part 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 view driven from a part needs both: the transform to place it, and this to decide whether to show it — the onHide option the sibling Players offer on their built-in attachments. useSsPartTransform reports the pose only, so this is the call a host makes alongside it.
Read from the display frame — floored when sub-frame is off, the same frame that was drawn — so it cannot disagree with what is on screen. It is that frame's hide: the animation's own, and a setPartOverrideshide: true too, on every descendant it hides when cascade is set. An override shows up once the player next advances or seeks, and at once on a stopped player. False for an unknown name, an out-of-range index and before the first advance; findPartIndex is the existence test.
Parameters
part
string | number
Returns
boolean
isPartSkinnedMesh()
isPartSkinnedMesh(
part):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1181
Whether part is a skinned mesh — a mesh part bound to bones, and so the one kind of part a follower cannot sit on.
A skinned mesh draws its vertices from its bound bones, while the part's own transform — what getPartTransform and useSsPartTransform report — stays at its setup node position, usually near the character root. So a view following such a part lands near the root rather than on the deformed art. To follow the art, add a NULL / bone part at that spot in SpriteStudio and follow that — a null, joint, armature or bone-point part places its own node where the art is. See Following a part.
False for a rigid (deform-only) mesh and every non-mesh part — those follow correctly — and false for an unknown name or before a load. The judgement is a mesh_binding present with at least one influence bone.
Parameters
part
string | number
Returns
boolean
isTrackFinished()
isTrackFinished(
track):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1579
Whether track's animation has played its loops out — a state, as isFinished is for track 0. A finished track above 0 holds its last frame; only track 0 finishing ends the character's playback.
Parameters
track
number
Returns
boolean
load()
load(
source,options?):Promise<void>
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:367
Loads a .ssab and, optionally, sets up an animation in it.
Replaces whatever was loaded before. Safe to call again while a previous load is still in flight: the older one is discarded rather than racing the newer one into place.
Parameters
source
options?
animation?
string
loadTextures?
boolean
measure?
Measure the content box while loading, for fit to place against.
Off by default because it costs a bake of every frame it walks, and a caller who supplies a frame — or wants the old scale-1 placement — should not pay for it. See SsMeasureRequest.
Returns
Promise<void>
partNames()
partNames():
string[]
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:689
Part names in part-index order, empty before a load finishes.
This is what turns the partIndex on an event back into something a human reads, and what fills a part picker. An unnamed part holds its slot as '' so the list stays index-aligned; length is the part count.
Returns
string[]
pause()
pause():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:851
Holds playback where it stands. Idempotent, and ignored while nothing plays.
Returns
void
Implementation of
play()
play(
startFrame?):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:815
Head-out: rewinds to the start of the section and re-arms the loop count.
Not a resume — resume is. Mapping a boolean prop onto the four verbs is Layer 4's job, and it is the only layer that knows the prop exists.
Parameters
startFrame?
number
Returns
void
Implementation of
resume()
resume():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:829
Lifts a pause, carrying on from the same frame.
Idempotent, and a no-op on a stopped animation: starting one is play's job, and play rewinds. No onAnimationStarted — a resume is not a start, and firing it here would make the two indistinguishable.
Returns
void
Implementation of
seek()
seek(
frameNo):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:863
Parameters
frameNo
number
Returns
void
Implementation of
setAnimation()
setAnimation(
name):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:729
Select an animation, and pose it on its first frame. Does not start playback — that is play's job, and keeping the two apart is what lets a caller swap the animation on a paused player, or show an idle pose.
Selecting the animation already set up does nothing at all. It is a switch, so with nothing to switch to it costs nothing and disturbs nothing: the playhead stays, the loop budget is not re-armed, and the overrides survive. That makes it safe for a state machine to assert its current clip every frame. To restart, call play.
"Already set up" is what track 0 plays now: after crossfade(0, 'run') that is run, even mid-fade, so naming it does nothing and the fade runs on — while naming the animation the fade is leaving is a real switch. A real switch collapses the track stack back to track 0, ending every overlay and fade and every setting of the tracks above 0. Track 0's playback settings stay.
Parameters
name
string
Returns
boolean
Implementation of
SpriteStudioPlayerApi.setAnimation
setAnimationSection()
setAnimationSection(
startFrame,endFrame):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:899
Restricts playback to [startFrame, endFrame] of the current animation, both ends included, so play, looping and ping-pong all work within that range. An end outside the animation's frames is its edge on that side.
Returns false, changing nothing, when both ends are inside the animation and the end is before the start, and says so on the console once per pair. False too before a pack is loaded.
Not carried across a setAnimation: frame numbers only mean something inside the animation they were measured in. Set it after each switch.
Parameters
startFrame
number
endFrame
number
Returns
boolean
Implementation of
SpriteStudioPlayerApi.setAnimationSection
setAnimationSectionByLabel()
setAnimationSectionByLabel(
startLabel,endLabel,startOffset?,endOffset?):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:929
setAnimationSection with the ends named by labels of the current animation: from startLabel's frame plus startOffset to endLabel's frame plus endOffset, the rule an Instance part's start and end labels follow. _start and _end name the animation's first and last frame. It does not play.
player.setAnimation('button')
player.setAnimationSectionByLabel('hover', 'pressed', 0, -1)
player.play()Returns false, changing nothing, when the animation has no such label or when the frames it lands on are a section setAnimationSection refuses, and says so on the console once. False too, and silent, before a pack is loaded. Like any section, setAnimation wipes it.
Parameters
startLabel
string
endLabel
string
startOffset?
number = 0
endOffset?
number = 0
Returns
boolean
Implementation of
SpriteStudioPlayerApi.setAnimationSectionByLabel
setCellmapTexture()
setCellmapTexture(
name,image,options?):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1814
Replaces the texture bound for a cellmap at runtime, or restores the pack's own when image is null. A costume change or a dynamic expression, driven from code rather than the authoring data.
name is a cellmap name — with no .ssce — or an external texture's file name, whichever getReplaceableTextureNames lists. The swap is keyed by the same hash DrawBatch.texture_hash carries, so it takes effect on the next drawn frame with nothing else to do. Returns false, with a dev warning, for a name the loaded pack has no such texture for; a name set before the first load is accepted and applied once the pack lands.
The replacement reaches instance children. The whole player tree draws through one texture table here, so a child that samples the same cellmap picks up the swap too — there is no per-child map to set separately. It also survives a source change: the override is re-keyed onto the new pack by name, and drops back out only when you clear it or dispose the player.
The image stays the caller's to keep alive — the registry references it and never disposes it, the same rule the textures prop follows. Two caveats: a part under an authored texture change (TCHG) binds through a different hash on the frames it applies to, so replace the texture file name it points at (also in getReplaceableTextureNames) rather than the cellmap name to affect those; and a replacement is assumed to share the original's size and layout, since the UVs stay in the original atlas's pixel space.
Parameters
name
string
image
SkImage | null
options?
Returns
boolean
setFrameRate()
setFrameRate(
fps):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1007
Overrides the advance rate, in absolute frames per second — the host's choice rather than the clip's, so it survives a setAnimation. Pass 0 (or a negative) to clear it and go back to whatever each animation was authored at.
setSpeedScale is the other rate control and they compose, but they say different things: speed is a multiple of whatever the clip was authored at, so it means the same against every clip; this replaces the rate, so 60 against a 30fps clip is double speed and against a 60fps clip is none.
Parameters
fps
number
Returns
void
Implementation of
SpriteStudioPlayerApi.setFrameRate
setFrameSkipEnabled()
setFrameSkipEnabled(
enabled):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:991
How a long tick is spent. On (the default) advances by the elapsed time and drops the frames in between, keeping playback on the wall clock; off advances exactly one frame per tick, so nothing is skipped but a stalled app plays in slow motion.
Turn it off when every frame matters — an animation whose events must all fire, or a deterministic capture.
Parameters
enabled
boolean
Returns
void
Implementation of
SpriteStudioPlayerApi.setFrameSkipEnabled
setLoopCount()
setLoopCount(
loops):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:873
0 = infinite.
Parameters
loops
number
Returns
void
Implementation of
SpriteStudioPlayerApi.setLoopCount
setPartOverrides()
setPartOverrides(
overrides):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1258
Applies a whole override map, and clears what a previous one set.
Declarative rather than incremental: a part that has dropped out of the map goes back to the animation, which is what makes the map describe the state rather than a history of calls. That is also why clearPartOverrides is not enough on its own — it would clear overrides another caller set through the escape hatch, so only the parts this method last touched are reverted.
Parameters
overrides
Returns
void
setPlaybackDirection()
setPlaybackDirection(
direction,style?):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:878
Parameters
direction
style?
SsPlaybackStyle = SsPlaybackStyle.normal
Returns
void
setRootTransform()
setRootTransform(
value):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1928
Parameters
value
Returns
void
setSourceEventThreshold()
setSourceEventThreshold(
source,threshold):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1656
The weight at or above which source fires its events. The default, Infinity, leaves every source but track 0's main one silent; lower it to hear an overlay's events, each arriving with its source.
Parameters
source
number
threshold
number
Returns
boolean
setSourceFrame()
setSourceFrame(
source,frameNo):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1642
Parameters
source
number
frameNo
number
Returns
boolean
setSourceWeight()
setSourceWeight(
source,weight):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1633
A source's share of its track, against the track's other sources.
Parameters
source
number
weight
number
Returns
boolean
setSpeedScale()
setSpeedScale(
rate):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:868
Multiplier on the authored frame rate. 0 and negatives stop the playhead where it stands rather than turning it around — reversing is setPlaybackDirection's job, not the speed's, and the Brain clamps both to the same stop.
Parameters
rate
number
Returns
void
Implementation of
SpriteStudioPlayerApi.setSpeedScale
setSubFrameEnabled()
setSubFrameEnabled(
enabled):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1023
Sub-frame interpolation — whether the frame handed to the Brain for display keeps its fraction. On by default, which is what makes playback smooth on a display refreshing faster than the animation was authored at.
The playhead is a float either way (frameNo reports it unrounded), and the instance / effect children are always stepped from the unrounded value. Turning this off only floors what is drawn, pinning playback to whole authored frames — and it reaches the instance children too, which are drawn at their own playhead and have to be floored on the same terms.
Parameters
enabled
boolean
Returns
void
Implementation of
SpriteStudioPlayerApi.setSubFrameEnabled
setTrackAlpha()
setTrackAlpha(
track,alpha):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1436
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/player/SpriteStudioPlayer.ts:1368
Lays name on track, replacing what it played, starting from its head (or at track 0's phase under setTrackSync). Tracks grow on demand.
On track 0 it is an animation switch with no fade: currentAnimation names it from the call, onAnimationChanged fires, and the loop count set with setLoopCount is put back on it — but unlike setAnimation the other tracks stay, and nothing is re-posed or restarted. A track above 0 that plays its loops out holds its last frame, still blended in, until you clear it or lay something else.
Parameters
track
number
name
string
Returns
boolean
setTrackBlend()
setTrackBlend(
track,blend):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1446
mix replaces the pose below by the track's alpha; additive adds its offset.
Parameters
track
number
blend
Returns
boolean
setTrackFrame()
setTrackFrame(
track,frameNo):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1469
Seeks track's animation — how a modulation axis authored as an animation is driven.
Parameters
track
number
frameNo
number
Returns
boolean
setTrackFrameRate()
setTrackFrameRate(
track,fps):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1498
track's absolute frame-rate override; 0 clears it. Track 0's is setFrameRate.
Parameters
track
number
fps
number
Returns
boolean
setTrackFrameSkipEnabled()
setTrackFrameSkipEnabled(
track,enabled):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1510
Track 0's is setFrameSkipEnabled.
Parameters
track
number
enabled
boolean
Returns
boolean
setTrackLoopCount()
setTrackLoopCount(
track,loops):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1562
How many times track's animation plays before it holds its last frame; 0 is forever. The animation's, unlike the other track settings: laying another one on a track above 0 starts it looping forever again. Track 0's is setLoopCount, which this player puts back on every animation track 0 switches to.
Parameters
track
number
loops
number
Returns
boolean
setTrackOutgoingEventThreshold()
setTrackOutgoingEventThreshold(
track,threshold):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1597
How far into a crossfade on track its outgoing side keeps firing events: while its share, 1 - progress, is at least threshold. The default, Infinity, silences it from the moment the fade begins — the moment the incoming side starts firing. 0.5 keeps it firing through the first half.
Parameters
track
number
threshold
number
Returns
boolean
setTrackPlaybackDirection()
setTrackPlaybackDirection(
track,direction,style?):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1527
Track 0's is setPlaybackDirection.
Parameters
track
number
direction
style?
SsPlaybackStyle = SsPlaybackStyle.normal
Returns
boolean
setTrackSpeed()
setTrackSpeed(
track,speed):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1484
track's speed multiplier. A track setting: it holds for every animation laid on the track, both sides of a crossfade included, and a track with nothing on it is created for it. Track 0's is setSpeedScale.
Parameters
track
number
speed
number
Returns
boolean
setTrackSync()
setTrackSync(
track,sync):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1459
Where an animation laid on track starts — set it before laying one. A track with nothing on it is created for it. Reset by setAnimation.
Parameters
track
number
sync
Returns
boolean
sourceEventThreshold()
sourceEventThreshold(
source):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1665
Parameters
source
number
Returns
number | null
sourceFrame()
sourceFrame(
source):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1647
Parameters
source
number
Returns
number | null
sourceWeight()
sourceWeight(
source):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1638
Parameters
source
number
Returns
number | null
startClock()
startClock():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:2038
Self-drives the animation off requestAnimationFrame.
Only for a player with no view attached — <SpriteStudioView> clocks its player itself, and running both would advance every frame twice.
Returns
void
stop()
stop():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:857
Halts where it stands — nothing rewinds. The next play() heads out.
Returns
void
Implementation of
stopClock()
stopClock():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:2056
Returns
void
trackAlpha()
trackAlpha(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1441
Parameters
track
number
Returns
number | null
trackBlend()
trackBlend(
track):SsTrackBlend|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1451
Parameters
track
number
Returns
SsTrackBlend | null
trackFadeProgress()
trackFadeProgress(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1424
How far the fade in flight on track has got, 0–1; null when none is.
Parameters
track
number
Returns
number | null
trackFrame()
trackFrame(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1474
Parameters
track
number
Returns
number | null
trackFrameRate()
trackFrameRate(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1505
The rate track's animation plays at — 0 with no animation and no override.
Parameters
track
number
Returns
number | null
trackFrameSkipEnabled()
trackFrameSkipEnabled(
track):boolean|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1520
Parameters
track
number
Returns
boolean | null
trackJustLooped()
trackJustLooped(
track):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1587
Whether the last advance wrapped track's animation — a pulse, as justLooped is for track 0. False after a tick that did not run.
Parameters
track
number
Returns
boolean
trackLoopCount()
trackLoopCount(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1569
-1 is forever; null for a track with no animation.
Parameters
track
number
Returns
number | null
trackMainSource()
trackMainSource(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1615
The source carrying track's animation, or null when it has none. After a crossfade begins, the incoming one. A finished fade releases its outgoing sources and their handles are reused, so read this rather than keep one.
Parameters
track
number
Returns
number | null
trackOutgoingEventThreshold()
trackOutgoingEventThreshold(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1606
Parameters
track
number
Returns
number | null
trackPlaybackDirection()
trackPlaybackDirection(
track):SsPlaybackDirection|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1544
Parameters
track
number
Returns
SsPlaybackDirection | null
trackPlaybackStyle()
trackPlaybackStyle(
track):SsPlaybackStyle|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1549
Parameters
track
number
Returns
SsPlaybackStyle | null
trackSpeed()
trackSpeed(
track):number|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1491
What was stored — a negative speed reads back as the stop it became.
Parameters
track
number
Returns
number | null
trackSync()
trackSync(
track):SsTrackSync|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:1464
Parameters
track
number
Returns
SsTrackSync | null