English
Abstract Class: InternalPlayerBase<T>
Defined in: src/InternalPlayerBase.ts:42
Generic InternalPlayerBase Encapsulates the engine-independent playback logic (play, pause, stop, update, etc.) and manages the SSRuntimeManager. Rendering engine wrappers (e.g., PixiJS, RMMZ) can hold or inherit this class to obtain vertex data and matrices required for rendering.
Extended by
Type Parameters
T
T extends InternalPlayerBase<T>
Constructors
Constructor
new InternalPlayerBase<
T>(resourceManager?):InternalPlayerBase<T>
Defined in: src/InternalPlayerBase.ts:90
Parameters
resourceManager?
Returns
InternalPlayerBase<T>
Properties
_instanceChildren
protected_instanceChildren:Map<number,InstanceChildState<T>>
Defined in: src/InternalPlayerBase.ts:86
_instancePackProvider
_instancePackProvider:
InstancePackProvider|null=null
Defined in: src/InternalPlayerBase.ts:66
_instancePackResources
_instancePackResources:
Map<number,SSABResource>
Defined in: src/InternalPlayerBase.ts:65
_isChildPlayer
_isChildPlayer:
boolean=false
Defined in: src/InternalPlayerBase.ts:64
runtimeManager
readonlyruntimeManager:SSRuntimeManager
Defined in: src/InternalPlayerBase.ts:43
Accessors
animationNames
Get Signature
get animationNames(): readonly
string[]
Defined in: src/InternalPlayerBase.ts:260
The bound SSAB's animation names, in table order; empty until a resource is bound. Read-only: it is the cache, not a copy, so hosts handing it to application code should copy it themselves.
Returns
readonly string[]
audioManager
Get Signature
get audioManager():
IAudioManager|null
Defined in: src/InternalPlayerBase.ts:107
Optional audio manager for the pack's sound parts.
Attaching one starts preloading the pack's sounds right away (in the background) when a resource is already bound — sounds belong to the pack, so there is nothing to wait for. Await preloadSounds if you need them in memory before playback rather than shortly after.
Returns
IAudioManager | null
Set Signature
set audioManager(
manager):void
Defined in: src/InternalPlayerBase.ts:111
Parameters
manager
IAudioManager | null
Returns
void
childrenMoved
Get Signature
get childrenMoved():
boolean
Defined in: src/InternalPlayerBase.ts:877
Whether the last update moved an effect or instance child — one playing on its own clock, or one synced to a playhead that moved — so a renderer that skips a frame it has already drawn knows that frame changed. Held players move only their independent children.
Returns
boolean
currentAnimation
Get Signature
get currentAnimation():
string
Defined in: src/InternalPlayerBase.ts:675
The animation track 0 plays: the one setAnimation selected, or the one a crossfade or setTrackAnimation on track 0 laid there since — from the call on, not from the end of the fade. '' before the first selection.
Returns
string
destroyed
Get Signature
get destroyed():
boolean
Defined in: src/InternalPlayerBase.ts:2238
Internal
Whether destroy has run; a listener may have called it mid-tick.
Returns
boolean
flipX
Get Signature
get flipX():
boolean
Defined in: src/InternalPlayerBase.ts:1814
Mirror the drawn animation horizontally. Only this player's own drawing is mirrored — the host object's transform, and anything parented to it, are left alone. Part-following targets follow the mirrored pose.
Returns
boolean
Set Signature
set flipX(
v):void
Defined in: src/InternalPlayerBase.ts:1815
Parameters
v
boolean
Returns
void
flipY
Get Signature
get flipY():
boolean
Defined in: src/InternalPlayerBase.ts:1818
Mirror the drawn animation vertically. See flipX.
Returns
boolean
Set Signature
set flipY(
v):void
Defined in: src/InternalPlayerBase.ts:1819
Parameters
v
boolean
Returns
void
isFinished
Get Signature
get isFinished():
boolean
Defined in: src/InternalPlayerBase.ts:973
Whether every configured loop has played.
A state, not a pulse: it latches when playback completes and stays true until the next play or switch of track 0's animation (setAnimation, or a crossfade or setTrackAnimation on track 0). It is track 0's: an overlay track finishing does not raise it, and neither does the outgoing side of a crossfade. Never true under an infinite loop count, and not raised by stop — a commanded stop is not a completion, which is what makes this readable as "the run ended on its own" where !isPlaying cannot tell the two apart.
For a one-shot notification take the edge instead — justFinished, or the player's own animation-end listener.
Returns
boolean
isHeld
Get Signature
get isHeld():
boolean
Defined in: src/InternalPlayerBase.ts:814
Whether a pause holds the character's clock — what a renderer reads, rather than isPausing, to tell whether a tick moves the timeline and so has events to poll.
Wider than isPausing in the same case as isTicking: isPausing reports track 0, so once track 0 has finished it stays false through a pause, while the pause still holds the tracks above it and any fade.
Returns
boolean
isPausing
Get Signature
get isPausing():
boolean
Defined in: src/InternalPlayerBase.ts:954
Gets whether the animation is currently pausing.
Returns
boolean
isPlaying
Get Signature
get isPlaying():
boolean
Defined in: src/InternalPlayerBase.ts:947
Gets whether the animation is currently playing.
Returns
boolean
isPlayingForward
Get Signature
get isPlayingForward():
boolean
Defined in: src/InternalPlayerBase.ts:989
Whether the playhead is currently walking forwards.
The instantaneous heading, not the configured direction: a ping-pong on its return leg reads false while getPlaybackDirection still reads Forward. It is what an audio backend gates on: SpriteStudio has no reverse audio.
Note this says nothing about getSpeedScale: the runtime clamps a zero or negative rate to a stop rather than to reverse playback, so the speed can never flip the heading and does not belong in a gate built on this.
Returns
boolean
isStackInMotion
Get Signature
get isStackInMotion():
boolean
Defined in: src/InternalPlayerBase.ts:801
Whether the track stack moves the pose apart from track 0's frame: a fade is running, or an audible track plays a source other than track 0's main one at a speed and weight above 0. The runtime answers, since it releases tracks and sources on its own as fades complete.
It does not read the clock, so a pause or a stop leaves it true. Read it before update: the tick a fade or a track ends on still moves the pose, and reads false afterwards.
Returns
boolean
isTicking
Get Signature
get isTicking():
boolean
Defined in: src/InternalPlayerBase.ts:783
Whether update has anything to move — what a renderer gates its per-tick work on, rather than isPlaying.
Wider than isPlaying in one case: track 0 running out does not stop the character's clock. The tracks above it, the sources added to any track and any fade carry on, and only track 0 reports the end, so a character whose track 0 has finished still ticks while isStackInMotion. stop stops all of it.
Returns
boolean
justFinished
Get Signature
get justFinished():
boolean
Defined in: src/InternalPlayerBase.ts:923
Whether the last pollPlaybackEvents saw playback complete — the rising edge of the sticky finished state, so it is true for exactly one tick. Distinct from is_finished, which stays true.
Returns
boolean
justLooped
Get Signature
get justLooped():
boolean
Defined in: src/InternalPlayerBase.ts:914
Whether the last pollPlaybackEvents saw a loop boundary crossed.
A pulse, not a state: it describes the tick that just ran and is replaced by the next one. Read from the copy the poll took rather than from the live runtime, which clears its own flag at the top of every update — reading that directly is how a caller loses the edge.
Returns
boolean
offsetX
Get Signature
get offsetX():
number
Defined in: src/InternalPlayerBase.ts:1827
Shift the drawn animation horizontally, in animation-local pixels, without moving the host object — useful for nudging artwork off its authored origin while the host keeps marking the logical position. Applied after flipX, so it is not itself mirrored.
Returns
number
Set Signature
set offsetX(
v):void
Defined in: src/InternalPlayerBase.ts:1828
Parameters
v
number
Returns
void
offsetY
Get Signature
get offsetY():
number
Defined in: src/InternalPlayerBase.ts:1831
Shift the drawn animation vertically (Y-down). See offsetX.
Returns
number
Set Signature
set offsetY(
v):void
Defined in: src/InternalPlayerBase.ts:1832
Parameters
v
number
Returns
void
resourceManager
Get Signature
get resourceManager():
IResourceManager|null
Defined in: src/InternalPlayerBase.ts:133
Returns
IResourceManager | null
ssabUrl
Get Signature
get ssabUrl():
string
Defined in: src/InternalPlayerBase.ts:178
URL the bound pack came from, or '' for one bound as bytes with no URL. Hosts otherwise have to remember this themselves to answer "is this the same pack?" when deciding between an in-place animation switch and a rebuild.
Returns
string
subFrameEnabled
Get Signature
get subFrameEnabled():
boolean
Defined in: src/InternalPlayerBase.ts:1041
Returns
boolean
Set Signature
set subFrameEnabled(
value):void
Defined in: src/InternalPlayerBase.ts:1045
Parameters
value
boolean
Returns
void
trackCount
Get Signature
get trackCount():
number
Defined in: src/InternalPlayerBase.ts:1261
Number of tracks, empty ones included; always at least 1.
Returns
number
Methods
addTrackSource()
addTrackSource(
track,animationName,weight):number
Defined in: src/InternalPlayerBase.ts:1490
Lay animationName on track beside what it already carries, at weight, and return its handle. On an empty track it becomes the main source. A handle stays valid until its source is released — by a crossfade completing, clearTrack or setAnimation — and is then reused, so drop it then.
Parameters
track
number
animationName
string
weight
number
Returns
number
bindResource()
bindResource(
buffer,ssabUrl?):void
Defined in: src/InternalPlayerBase.ts:192
Binds the SSAB buffer to the player and extracts required texture paths.
Parameters
buffer
Uint8Array
The raw byte array of the SSAB file.
ssabUrl?
string
Optional source URL of the SSAB. When given, textures and instance packs resolve relative to its directory (siblings of the SSAB — the structure ssconverter emits), and a player already holding the same bytes from the same URL shares its pack instead of a copy (SharedPacks). Omit for inline / ArrayBuffer loads whose textures are supplied by hash rather than fetched.
Returns
void
bindSharedResource()
bindSharedResource(
resource):void
Defined in: src/InternalPlayerBase.ts:622
Binds an already loaded SSABResource to the player (used by instance children).
Parameters
resource
The shared SSABResource.
Returns
void
cancelTrackFade()
cancelTrackFade(
track):void
Defined in: src/InternalPlayerBase.ts:1470
Stop the fade on track, leaving alpha and weights where they stand.
Parameters
track
number
Returns
void
clearAllPartOverrides()
clearAllPartOverrides():
boolean
Defined in: src/InternalPlayerBase.ts:1664
Clear every per-part override on this player (all parts, all attributes).
Returns
boolean
clearPartCellOverride()
clearPartCellOverride(
part):boolean
Defined in: src/InternalPlayerBase.ts:1657
Clear a part's cell override (revert it to the animation).
Parameters
part
string | number
Returns
boolean
clearPartColorOverride()
clearPartColorOverride(
part):boolean
Defined in: src/InternalPlayerBase.ts:1627
Clear a part's colour override (revert it to the animation).
Parameters
part
string | number
Returns
boolean
clearPartVisibilityOverride()
clearPartVisibilityOverride(
part):boolean
Defined in: src/InternalPlayerBase.ts:1581
Clear a part's visibility override (revert it to the animation).
Parameters
part
string | number
Returns
boolean
clearTrack()
clearTrack(
track):void
Defined in: src/InternalPlayerBase.ts:1278
Silence a track. Track 0 cannot be emptied: fade it to alpha 0 with fadeTrack instead.
Parameters
track
number
Returns
void
createChildPlayer()
abstractprotectedcreateChildPlayer(resourceManager?):T
Defined in: src/InternalPlayerBase.ts:2233
Frees the allocated memory.
Parameters
resourceManager?
Returns
T
crossfade()
crossfade(
track,animationName,durationMs):void
Defined in: src/InternalPlayerBase.ts:1448
Fade track to animationName over durationMs, from whatever it is playing; every source on it fades out together. Advanced by update, and an empty track starts playing at once.
On track 0, animationName takes over from the call on, not when the fade completes: it is the currentAnimation, its state is what isFinished and the frame read-outs report, its events fire, and it plays with the speed, direction and loop count the host set. The outgoing one running out mid-fade does not finish the character. The instance children are not rebuilt the way setAnimation rebuilds them: the instance and effect parts belong to the pack, so they carry on.
Crossfading again mid-fade takes the fade over where it stands, so the pose does not jump.
Parameters
track
number
animationName
string
durationMs
number
Returns
void
destroy()
destroy():
void
Defined in: src/InternalPlayerBase.ts:2242
Returns
void
evaluateDrawFrame()
evaluateDrawFrame():
void
Defined in: src/InternalPlayerBase.ts:1865
Evaluates the frame the renderer is about to draw (getDrawFrame), so the part read-outs report it. Called by a facade that drives its followers or onFrame listeners before its own draw: without it they read the frame drawn last time, one behind. The draw evaluates the frame again, so call it only when something is going to read. Allocates nothing.
Returns
void
fadeTrack()
fadeTrack(
track,targetAlpha,durationMs):void
Defined in: src/InternalPlayerBase.ts:1459
Drive track's alpha to targetAlpha over durationMs — how strongly it applies, not what it plays (that is crossfade). Fading track 0 to 0 settles the character onto the setup pose.
Parameters
track
number
targetAlpha
number
durationMs
number
Returns
void
findPartIndex()
findPartIndex(
partName):number
Defined in: src/InternalPlayerBase.ts:1562
Resolve a part name to its index in the current animation, or -1 when the name is unknown / no animation is set up yet.
Parameters
partName
string
Returns
number
getAnimationSectionEnd()
getAnimationSectionEnd():
number
Defined in: src/InternalPlayerBase.ts:1126
Returns
number
getAnimationSectionStart()
getAnimationSectionStart():
number
Defined in: src/InternalPlayerBase.ts:1122
Returns
number
getCanvasRect()
getCanvasRect():
SSPlacementBox|null
Defined in: src/InternalPlayerBase.ts:278
The authored canvas of the animation that is set up, as a box in player-local units (Y down) — what a fit measures against when it is given no frame of its own. null until an animation is set up.
It is the playing animation's own canvas, and one pack's animations may differ. A host that wants one scale across a pack reads it once after its first setAnimation and passes it as the fit's frame. Read-only: it is the cache, not a copy.
Returns
SSPlacementBox | null
getCellmapNames()
getCellmapNames():
string[]
Defined in: src/InternalPlayerBase.ts:1683
Returns
string[]
getCellmapTexture()
getCellmapTexture(
cellmapName):unknown
Defined in: src/InternalPlayerBase.ts:1749
The current runtime override for cellmapName (the object last passed to setCellmapTexture), or undefined when nothing is overridden. This returns only the override — never the originally loaded texture.
Parameters
cellmapName
string
Returns
unknown
getCellNames()
getCellNames(
cellmapName):string[]
Defined in: src/InternalPlayerBase.ts:1688
Cell names inside cellmapName, empty if that map isn't in this SSAB.
Parameters
cellmapName
string
Returns
string[]
getDrawFrame()
getDrawFrame():
number
Defined in: src/InternalPlayerBase.ts:1074
The frame actually drawn this tick: the playhead, floored while subFrameEnabled is off.
Every draw-side read goes through this — the renderers, the instance children's frames, isPartHidden — so that what is asked of the runtime is always the frame that ends up on screen. Turning sub-frame off does nothing else; this is the whole of it.
Returns
number
getEffectDrawPlan()
getEffectDrawPlan(
partIndex):EffectDrawPlan|null
Defined in: src/InternalPlayerBase.ts:1009
Parameters
partIndex
number
Returns
EffectDrawPlan | null
getFrameNo()
getFrameNo():
number
Defined in: src/InternalPlayerBase.ts:1061
Where the playhead is, fractional — the value the conventions call frameNo.
Reports the playhead itself, not the frame being drawn: with subFrameEnabled off the renderer shows frame 12 while this still reads 12.4. Use getDrawFrame to ask what is on screen.
Returns
number
getFrameRate()
getFrameRate():
number
Defined in: src/InternalPlayerBase.ts:1087
Returns
number
getInstanceChild()
getInstanceChild(
partIndex):InstanceChildState<T> |undefined
Defined in: src/InternalPlayerBase.ts:2212
Parameters
partIndex
number
Returns
InstanceChildState<T> | undefined
getLabelTable()
getLabelTable(
animationName?):SSLabelTable|null
Defined in: src/InternalPlayerBase.ts:1169
The labels of animationName in the bound pack — the current animation when omitted — in frame order, with the frame range it was authored with. Null before a pack is bound, or for an animation the pack does not have.
Read out of the pack on every call, so hold the table rather than calling this per frame.
Parameters
animationName?
string
Returns
SSLabelTable | null
getLoopCount()
getLoopCount():
number
Defined in: src/InternalPlayerBase.ts:1224
The count in force. Read from the runtime, so it is the normalized value: ask for 0 and this reads back -1, the infinite sentinel.
Returns
number
getPartNames()
getPartNames():
string[]
Defined in: src/InternalPlayerBase.ts:1679
Part names in part-index order, empty before an animation is set up.
A part authored without a name reads as the empty string, so the list stays aligned with the partIndex every event carries — which is what turns one back into something a human reads. length is the part count.
Returns
string[]
getPartQuad()
getPartQuad(
part,out?):SSPartQuad|null
Defined in: src/InternalPlayerBase.ts:1959
The outline the part is drawn with on the frame last evaluated, as an SSPartQuad in the space getPartTransform reports, flip and offset included — or null when the part is unknown or hidden, draws nothing of its own, or no frame has been evaluated. Pass out (a Float32Array(8)) to avoid allocation.
It is the outline as drawn. A part with a cell is its four drawn corners, skew and vertex deform included. A Mesh part is the axis-aligned box around its vertices, which the runtime hands over in world space and a skinned mesh's own transform does not describe. A part with a size and no cell — a Shape — is that size around its pivot, through its pose; a vertex deform that carries a Shape's vertices outside its size is not followed. Null, bone, Instance and Effect parts have no size, and read null; a part drawn at alpha 0 still has an outline. It evaluates nothing.
Parameters
part
string | number
out?
Float32Array<ArrayBufferLike>
Returns
SSPartQuad | null
getPartTransform()
getPartTransform(
part,out?):Float32Array<ArrayBufferLike> |null
Defined in: src/InternalPlayerBase.ts:1883
The part's current-frame transform as a 2D affine [m00, m01, m10, m11, tx, ty] in animation-local space (Y down once setCoordinateSystem(YDown) has run, as every renderer here does it), copied out of WASM (safe to retain). Returns null when the part name/index is unknown in the current animation. Pass out (a Float32Array(6)) to avoid allocation. Valid for the frame last evaluated — the last one drawn, or the one evaluateDrawFrame evaluated; the matrix is computed for every part regardless of hide, so a hidden part still reports where it would be.
flipX / flipY / offsetX / offsetY are included: this reports where the part is actually drawn, so a follower stays pinned to it across a flip.
Parameters
part
string | number
out?
Float32Array<ArrayBufferLike>
Returns
Float32Array<ArrayBufferLike> | null
getPlaybackDirection()
getPlaybackDirection():
WebPlaybackDirection
Defined in: src/InternalPlayerBase.ts:1199
Returns
getPlaybackStyle()
getPlaybackStyle():
WebPlaybackStyle
Defined in: src/InternalPlayerBase.ts:1203
Returns
getReplaceableTextureNames()
getReplaceableTextureNames():
string[]
Defined in: src/InternalPlayerBase.ts:1758
Names setCellmapTexture can replace: cell-map names plus TextureChange target file names. See SSRuntimeManager.getReplaceableTextureNames.
Returns
string[]
getRootAffine()
getRootAffine():
Float32Array<ArrayBufferLike> |null
Defined in: src/InternalPlayerBase.ts:1843
flipX / flipY / offsetX / offsetY resolved into one 2D affine [m00, m01, m10, m11, tx, ty], or null when they are all at their defaults.
The returned array is this player's live buffer — read it, do not retain or mutate it. Renderers compose it as the root context's parent matrix (or into the draw transform); nothing else should apply it, or it lands twice.
Returns
Float32Array<ArrayBufferLike> | null
getSourceEventThreshold()
getSourceEventThreshold(
source):number|undefined
Defined in: src/InternalPlayerBase.ts:1523
Parameters
source
number
Returns
number | undefined
getSourceFrame()
getSourceFrame(
source):number|undefined
Defined in: src/InternalPlayerBase.ts:1509
Parameters
source
number
Returns
number | undefined
getSourceWeight()
getSourceWeight(
source):number|undefined
Defined in: src/InternalPlayerBase.ts:1500
Parameters
source
number
Returns
number | undefined
getSpeedScale()
getSpeedScale():
number
Defined in: src/InternalPlayerBase.ts:1004
The playback speed in effect, as a multiple of the frame rate.
Read from the runtime rather than from a copy of what was last set: the runtime clamps a zero or negative rate to a stop, so a cache would report the -1.0 that was asked for while playback is actually held at 0.0.
Returns
number
getTotalFrames()
getTotalFrames():
number
Defined in: src/InternalPlayerBase.ts:1079
Returns
number
getTrackAlpha()
getTrackAlpha(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1290
Parameters
track
number
Returns
number | undefined
getTrackBlend()
getTrackBlend(
track):SSTrackBlend|undefined
Defined in: src/InternalPlayerBase.ts:1299
Parameters
track
number
Returns
SSTrackBlend | undefined
getTrackFadeProgress()
getTrackFadeProgress(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1465
How far the fade on track has got, 0 to 1; undefined when it is not fading.
Parameters
track
number
Returns
number | undefined
getTrackFrame()
getTrackFrame(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1325
Parameters
track
number
Returns
number | undefined
getTrackFrameRate()
getTrackFrameRate(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1348
The rate track's animation plays at, the override or the authored rate; 0 for a track with neither.
Parameters
track
number
Returns
number | undefined
getTrackFrameSkipEnabled()
getTrackFrameSkipEnabled(
track):boolean|undefined
Defined in: src/InternalPlayerBase.ts:1357
Parameters
track
number
Returns
boolean | undefined
getTrackLoopCount()
getTrackLoopCount(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1392
-1 for a track that loops forever; undefined for one with no animation.
Parameters
track
number
Returns
number | undefined
getTrackMainSource()
getTrackMainSource(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1479
The source carrying track's animation — the one setAnimation, setTrackAnimation or crossfade laid there (mid-crossfade, the incoming one); undefined when it has none.
Parameters
track
number
Returns
number | undefined
getTrackOutgoingEventThreshold()
getTrackOutgoingEventThreshold(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1428
Parameters
track
number
Returns
number | undefined
getTrackPlaybackDirection()
getTrackPlaybackDirection(
track):WebPlaybackDirection|undefined
Defined in: src/InternalPlayerBase.ts:1367
Parameters
track
number
Returns
WebPlaybackDirection | undefined
getTrackPlaybackStyle()
getTrackPlaybackStyle(
track):WebPlaybackStyle|undefined
Defined in: src/InternalPlayerBase.ts:1371
Parameters
track
number
Returns
WebPlaybackStyle | undefined
getTrackSpeed()
getTrackSpeed(
track):number|undefined
Defined in: src/InternalPlayerBase.ts:1338
What setTrackSpeed stored; a negative speed reads back as the 0 it became.
Parameters
track
number
Returns
number | undefined
getTrackSync()
getTrackSync(
track):SSTrackSync|undefined
Defined in: src/InternalPlayerBase.ts:1314
Parameters
track
number
Returns
SSTrackSync | undefined
hasMaskWriterParts()
hasMaskWriterParts():
boolean
Defined in: src/InternalPlayerBase.ts:2221
Whether this player's pack, or an instance child's at any depth, has a part that can write a mask. When it is false, a mask plan of this tree finds no writer.
Returns
boolean
hitTestPart()
hitTestPart(
x,y,parts?):number
Defined in: src/InternalPlayerBase.ts:1977
The index of the front-most part whose getPartQuad outline holds (x, y), among parts (names or indices; every part when omitted), on the frame last evaluated — or -1 when none does, as findPartIndex answers. The point is in the space getPartTransform reports. A name the animation does not have is skipped.
Parameters
x
number
y
number
parts?
readonly (string | number)[]
Returns
number
isFrameSkipEnabled()
isFrameSkipEnabled():
boolean
Defined in: src/InternalPlayerBase.ts:1232
Returns
boolean
isPartHidden()
isPartHidden(
part):boolean|null
Defined in: src/InternalPlayerBase.ts:1909
Whether the part is hidden on the frame last evaluated — the last one drawn, or the one evaluateDrawFrame evaluated, the same frame getPartTransform reads. That is the visibility the renderer honours: the animation's hide keyframe with a setPartVisibilityOverride force-hide and its cascade applied.
It evaluates nothing, so an override reads back from the next frame evaluated, as it is drawn. Evaluating here would also change what the next update builds: an OverwriteOnNextKeyframe override set right after play or a seek goes back to the animation if any frame is built before that update. Returns false for a known part before any frame has been evaluated, and null when the part is unknown.
Parameters
part
string | number
Returns
boolean | null
isPartSkinnedMesh()
isPartSkinnedMesh(
part):boolean|null
Defined in: src/InternalPlayerBase.ts:1937
Whether the part is a skinned mesh — a mesh part bound to bones, whose vertices are drawn by bone skinning while the part's own transform stays at its setup node position (usually near the character root). Returns null when the part name/index is unknown.
This is a static property of the asset, not of a frame, and it exists for part following: getPartTransform reports a part's node transform, which for a skinned mesh is not where its art ends up, so following one snaps the target near the root rather than onto the visible mesh. Target a NULL / bone / joint part placed at that spot instead. A rigid (deform-only, unbound) mesh returns false — its node transform does move with the art, so it follows correctly. Nothing here blocks following either way; this only lets a host mark a poor target (e.g. dim it in a follow-target picker).
Parameters
part
string | number
Returns
boolean | null
isSeekLanding()
isSeekLanding(
frameNo):boolean
Defined in: src/InternalPlayerBase.ts:867
Internal
Whether an audio key on frameNo, reported by the update that just ran, is where a seek landed rather than a key the playhead crossed. Audio gates leave such keys unsounded.
Parameters
frameNo
number
Returns
boolean
isTrackFinished()
isTrackFinished(
track):boolean
Defined in: src/InternalPlayerBase.ts:1401
Whether track's animation has played its loop count out and holds its last frame. A state, as isFinished is for track 0; there is no listener for it. Only track 0 finishing ends the character's playback.
Parameters
track
number
Returns
boolean
load()
load(
ssabUrl):Promise<void>
Defined in: src/InternalPlayerBase.ts:150
Fetches and binds an SSAB file to the player, then loads everything the pack needs (textures, instance packs) — when this resolves the player is ready to draw and setAnimation does no asset I/O at all. Textures and instance packs always resolve relative to the SSAB's own location (the structure that ssconverter emits) — there is no separate asset-base override.
Only the last load() or bind counts. One overtaken by another, or by destroy, resolves without binding anything, so compare the ssabUrl property before going on from it.
Parameters
ssabUrl
string
The URL of the SSAB file.
Returns
Promise<void>
loadTextures()
loadTextures():
Promise<void>
Defined in: src/InternalPlayerBase.ts:295
Loads all textures required by the bound SSAB resource via the ResourceManager. Textures resolve relative to the SSAB's own location (set on load/bind).
Prefer prepareResources, which pairs this with the instance packs and runs both exactly once per bound resource.
Returns
Promise<void>
pause()
pause():
void
Defined in: src/InternalPlayerBase.ts:743
Holds playback on the current frame.
Idempotent, and ignored while nothing is playing. isPlaying stays true while held — a pause is a hold, not a stop — so isPausing is what tells the two apart.
Returns
void
play()
play(
startFrame?):void
Defined in: src/InternalPlayerBase.ts:689
Starts the animation playback from the head of its section, re-arming the loop count.
Not a resume: -1 heads out from the section start (its end when the direction is backward) rather than carrying on from the playhead. Pass getFrameNo() to play on from where it stands, and resume to lift a hold.
Parameters
startFrame?
number = -1
The frame to start playing from. -1 means from the start of the section.
Returns
void
pollPlaybackEvents()
pollPlaybackEvents():
object
Defined in: src/InternalPlayerBase.ts:892
Reads the playback events produced by the most recent update.
Must be called on the same tick that advanced, and only on that tick — looped is a pulse the runtime clears on entry to every update, so a later read loses it.
finished is a sticky state rather than a pulse, so it is reported only on its rising edge; play re-arms it. It is never raised under an infinite loop count, nor by a commanded stop.
Returns
object
finished
finished:
boolean
looped
looped:
boolean
preloadSounds()
preloadSounds():
Promise<void>
Defined in: src/InternalPlayerBase.ts:388
Preload the pack's sounds into the attached audioManager, once. Like the textures these are listed per pack (soundLists on the binary), so the set does not change with the animation; the manager is tracked rather than a flag so one attached later still gets its preload. Resolves immediately when there is no manager, no bound pack, or the work is already done.
Returns
Promise<void>
prepareResources()
prepareResources():
Promise<void>
Defined in: src/InternalPlayerBase.ts:346
Load every asset the bound pack needs, whichever animation ends up playing: all cell-map textures and, transitively, every instance-referenced pack. None of it is animation-scoped — the cell maps live on the binary, not on the animation table — so it is loaded once here rather than on each switch.
Idempotent: the work runs once per bound resource and later calls return the same promise (a failed attempt is not cached, so a 404'd texture can be retried). load() awaits it, so URL-loaded packs are ready before the first setAnimation; hosts that bind bytes themselves should await it after bindResource to keep the first switch free of asset I/O too.
Returns
Promise<void>
resume()
resume():
void
Defined in: src/InternalPlayerBase.ts:754
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 heads out to the section start rather than carrying on.
Returns
void
setAnimation()
setAnimation(
animationName):void
Defined in: src/InternalPlayerBase.ts:462
Switch to animationName. Synchronous, by design: an animation switch is a runtime context reset and nothing more.
Everything that could stall — textures, instance packs, sounds — belongs to the pack, not to the animation, and is loaded once by load() / prepareResources. Calling this on a pack whose assets are not in yet still switches immediately (the runtime needs no textures to set up an animation; the renderer simply has nothing to draw with until they land) and the load is started in the background.
Selecting the animation already selected does nothing at all. It is a switch, so with nothing to switch to it costs nothing and disturbs nothing: the playhead stays, the instance tree is not rebuilt, and the override layer survives. It is what lets a state machine call setAnimation(state.clip) every frame without thinking about it. An animation a crossfade on track 0 brought in counts as selected from the moment it was called, so naming it mid-fade leaves the fade running, and naming the one it faded out from switches back to it. To restart the animation call play, which heads out; to drop the overrides call clearAllPartOverrides.
A playback section is not among the things that survive: a real switch resets it, because frame numbers mean nothing against a different animation. Call setAnimationSection again after each switch.
Parameters
animationName
string
The name of the animation to set.
Returns
void
setAnimationSection()
setAnimationSection(
startFrame,endFrame):boolean
Defined in: src/InternalPlayerBase.ts:1101
Limits playback to [startFrame, endFrame] of the current animation, both ends included, so a section whose ends are one frame holds it. An end outside the animation (-1, say) is the animation's edge on that side. Moves the playhead to the start of the section.
Returns false, and says so once in the console, when both ends are inside the animation and the end is before the start; the section and the playhead stay as they were.
Parameters
startFrame
number
endFrame
number
Returns
boolean
setAnimationSectionByLabel()
setAnimationSectionByLabel(
startLabel,endLabel,startOffset?,endOffset?):boolean
Defined in: src/InternalPlayerBase.ts:1144
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, as they do in SpriteStudio. It does not play.
Returns false when the current animation has no such label, or when the frames it lands on are a section setAnimationSection refuses (both inside the animation, the end before the start), and says so once in the console; the section stays as it was. Before an animation is set up it returns false and says nothing. Like any section, setAnimation wipes it.
Parameters
startLabel
string
endLabel
string
startOffset?
number = 0
endOffset?
number = 0
Returns
boolean
setCellmapTexture()
setCellmapTexture(
cellmapName,texture):void
Defined in: src/InternalPlayerBase.ts:1729
Replace (or restore) the texture bound to a cell-map / external-texture name at runtime.
Parameters
cellmapName
string
A name from getReplaceableTextureNames — a cell-map name (common) or a TextureChange target file name (common.png). An unknown name hashes to a key nothing draws, so the call is a harmless no-op rather than an error.
texture
unknown
The engine-specific texture object to bind, or null to clear the override and restore the originally loaded texture.
The texture object is caller-owned; the player never frees it. Requires a ResourceManager that implements IResourceManager.setOverrideTexture; throws otherwise.
Returns
void
setCoordinateSystem()
setCoordinateSystem(
system):void
Defined in: src/InternalPlayerBase.ts:935
Sets the coordinate system for the runtime.
Propagates to the instance children (each sub-animation is its own runtime context): they inherit the system once, when they are created, so without this a later switch would flip the root animation while every instance part kept rendering mirrored. Mirrors subFrameEnabled.
Parameters
system
Returns
void
setFrameNo()
setFrameNo(
frameNo):void
Defined in: src/InternalPlayerBase.ts:1034
Moves the playhead to frameNo, which may be fractional.
Stored as given even while subFrameEnabled is off. Flooring is a property of the frame that gets drawn — getDrawFrame — not of the playhead, so turning sub-frame back on recovers the fraction instead of finding it already thrown away.
Parameters
frameNo
number
Returns
void
setFrameRate()
setFrameRate(
fps):void
Defined in: src/InternalPlayerBase.ts:1083
Parameters
fps
number
Returns
void
setFrameSkipEnabled()
setFrameSkipEnabled(
skip):void
Defined in: src/InternalPlayerBase.ts:1228
Parameters
skip
boolean
Returns
void
setInstancePackProvider()
setInstancePackProvider(
provider):void
Defined in: src/InternalPlayerBase.ts:129
Supply a resolver for instance-referenced packs that aren't fetchable by <base>/<name>.ssab (e.g. drag-and-drop). Called by loadInstancePacks before falling back to fetch. When a pack is served this way the host must also register that pack's textures (by cell-map hash) into the ResourceManager beforehand, since the core won't fetch them.
Parameters
provider
InstancePackProvider | null
Returns
void
setLoopCount()
setLoopCount(
count):void
Defined in: src/InternalPlayerBase.ts:1215
How many times to play: n cycles then stop, -1 loops forever, and 0 asks for the same as -1 rather than "no cycles".
Kept across a setAnimation, and across a crossfade or setTrackAnimation on track 0, because it is the caller's configuration rather than the animation's.
Parameters
count
number
Returns
void
setPartCellOverride()
setPartCellOverride(
part,cellmapName,cellName,priority?):boolean
Defined in: src/InternalPlayerBase.ts:1643
Make a part draw a different cell, named by its cell map (without the .ssce extension) and cell name. The names are resolved once, here, so an unresolvable cell returns false immediately rather than failing per frame; empty names revert the part to the animation. See getCellmapNames / getCellNames for the valid targets.
Applies to Normal and mask parts only. Swapping in a cell from another texture changes that part's draw batch, which the runtime plans for.
Parameters
part
string | number
cellmapName
string
cellName
string
priority?
SSOverridePriority = SSOverridePriority.HoldUntilNextAnimation
Returns
boolean
setPartColorOverride()
setPartColorOverride(
part,rgba,blendOp?,priority?):boolean
Defined in: src/InternalPlayerBase.ts:1597
Override a part's colour with a single value applied to all four corners. rgba is packed 0xRRGGBBAA and is interpreted in the same 8-bit sRGB space as the authored PartColor: the runtime pre-multiplies its alpha with the part's composed alpha itself, so do not pre-multiply or gamma-convert it here.
Applies to Normal parts only. Other part types silently ignore it — the call still returns true, so success does not mean the part changed.
Parameters
part
string | number
rgba
number
blendOp?
SSBlendOp = SSBlendOp.Mix
priority?
SSOverridePriority = SSOverridePriority.HoldUntilNextAnimation
Returns
boolean
setPartColorOverrideCorners()
setPartColorOverrideCorners(
part,corners,blendOp?,priority?):boolean
Defined in: src/InternalPlayerBase.ts:1614
Override a part's colour with four distinct corners, for a gradient. Same contract as setPartColorOverride; corners is in the runtime's order — left-top, right-top, left-bottom, right-bottom — and getting that order wrong silently flips the gradient rather than failing.
Parameters
part
string | number
corners
readonly [number, number, number, number]
blendOp?
SSBlendOp = SSBlendOp.Mix
priority?
SSOverridePriority = SSOverridePriority.HoldUntilNextAnimation
Returns
boolean
setPartVisibilityOverride()
setPartVisibilityOverride(
part,hide,cascade?):boolean
Defined in: src/InternalPlayerBase.ts:1573
Force-hide a part (hide = true) or revert it to the animation (false). With cascade the force-hide propagates to the part's descendants — note that a keyframe hide never cascades, so this is the only way to hide a whole sub-tree. Visibility has no priority mode: it always beats the keyframe and is always cleared when a new animation is set up.
Parameters
part
string | number
hide
boolean
cascade?
boolean = false
Returns
boolean
setPlaybackDirection()
setPlaybackDirection(
direction,style):void
Defined in: src/InternalPlayerBase.ts:1195
Parameters
direction
style
Returns
void
setResourceManager()
setResourceManager(
resourceManager):void
Defined in: src/InternalPlayerBase.ts:118
Parameters
resourceManager
Returns
void
setSourceEventThreshold()
setSourceEventThreshold(
source,threshold):void
Defined in: src/InternalPlayerBase.ts:1518
The weight at or above which source fires its events. Only track 0's main source fires by default — the default threshold is Infinity — so lower this to the source's weight or below to have another one fire too.
Parameters
source
number
threshold
number
Returns
void
setSourceFrame()
setSourceFrame(
source,frame):void
Defined in: src/InternalPlayerBase.ts:1505
Seek one source — how a host keeps sources of different lengths in step.
Parameters
source
number
frame
number
Returns
void
setSourceWeight()
setSourceWeight(
source,weight):void
Defined in: src/InternalPlayerBase.ts:1496
A source's share within its track; weights are ratios, so (0.7, 0.3) and (7, 3) mix alike.
Parameters
source
number
weight
number
Returns
void
setSpeedScale()
setSpeedScale(
speed):void
Defined in: src/InternalPlayerBase.ts:993
Parameters
speed
number
Returns
void
setTrackAlpha()
setTrackAlpha(
track,alpha):void
Defined in: src/InternalPlayerBase.ts:1286
How much of track survives onto the pose below — the strength of a layer. Not clamped: above 1 extrapolates, 0 or below contributes nothing.
Parameters
track
number
alpha
number
Returns
void
setTrackAnimation()
setTrackAnimation(
track,animationName):void
Defined in: src/InternalPlayerBase.ts:1271
Put animationName on track, replacing what it was playing, with no fade. Tracks are made as needed. On track 0 it becomes the currentAnimation from the call on; unlike setAnimation it leaves the stack above and the instance children as they are.
Parameters
track
number
animationName
string
Returns
void
setTrackBlend()
setTrackBlend(
track,blend):void
Defined in: src/InternalPlayerBase.ts:1295
SSTrackBlend.Mix lerps onto what is below; SSTrackBlend.Additive adds the offset from the setup pose.
Parameters
track
number
blend
Returns
void
setTrackFrame()
setTrackFrame(
track,frame):void
Defined in: src/InternalPlayerBase.ts:1319
Seek track's animation — how a continuous-control axis is driven, with its speed at 0.
Parameters
track
number
frame
number
Returns
void
setTrackFrameRate()
setTrackFrameRate(
track,fps):void
Defined in: src/InternalPlayerBase.ts:1343
setFrameRate for one track.
Parameters
track
number
fps
number
Returns
void
setTrackFrameSkipEnabled()
setTrackFrameSkipEnabled(
track,skip):void
Defined in: src/InternalPlayerBase.ts:1353
setFrameSkipEnabled for one track.
Parameters
track
number
skip
boolean
Returns
void
setTrackLoopCount()
setTrackLoopCount(
track,count):void
Defined in: src/InternalPlayerBase.ts:1384
How many times track's animation plays before it holds its last frame; -1 (or 0) loops forever. Throws on a track with no animation, and an animation is laid looping forever, so set it after laying. A finished track keeps mixing its last frame in until the host fades or clears it.
On track 0 this is setLoopCount: the player keeps the count and puts it back on every animation laid there.
Parameters
track
number
count
number
Returns
void
setTrackOutgoingEventThreshold()
setTrackOutgoingEventThreshold(
track,threshold):void
Defined in: src/InternalPlayerBase.ts:1423
How far into a crossfade on track the outgoing animation keeps firing events: while its share of the track, 1 - progress, is at least threshold. The default, Infinity, silences it the moment the fade begins — on track 0, just as the incoming one starts firing; 0.5 keeps it firing for the first half. Kept by the track, so it holds for every crossfade on it, and track 0's survives setAnimation.
Parameters
track
number
threshold
number
Returns
void
setTrackPlaybackDirection()
setTrackPlaybackDirection(
track,direction,style):void
Defined in: src/InternalPlayerBase.ts:1362
setPlaybackDirection for one track.
Parameters
track
number
direction
style
Returns
void
setTrackSpeed()
setTrackSpeed(
track,speed):void
Defined in: src/InternalPlayerBase.ts:1333
track's playback speed, a multiple of its frame rate; 0 parks it where setTrackFrame puts it. On track 0 this is setSpeedScale.
Parameters
track
number
speed
number
Returns
void
setTrackSync()
setTrackSync(
track,sync):void
Defined in: src/InternalPlayerBase.ts:1310
Where the animations laid on track from now on start: SSTrackSync.Free from their head, SSTrackSync.Start at the phase track 0 stands at. Set it before laying — it covers setTrackAnimation, crossfade (track 0's too) and addTrackSource.
Parameters
track
number
sync
Returns
void
stop()
stop():
void
Defined in: src/InternalPlayerBase.ts:763
Ends playback. The playhead stays where it stands — nothing rewinds, so the renderer keeps drawing the frame it stopped on. play() is what returns to the head; setFrameNo() seeks anywhere else.
Returns
void
trackJustLooped()
trackJustLooped(
track):boolean
Defined in: src/InternalPlayerBase.ts:1411
Whether the last update wrapped track's animation back to its start — a pulse, as justLooped is for track 0. False after an update that moved nothing (paused, stopped), since the runtime keeps its pulse until it next runs.
Parameters
track
number
Returns
boolean
update()
update(
deltaMs):void
Defined in: src/InternalPlayerBase.ts:830
Updates the animation frame by the given delta time.
When paused, the main timeline is NOT advanced, but the effect / instance slots are still stepped with the real delta so that independent parts keep running on their own clock (SpriteStudio independent semantics). The runtime's step() ignores the delta for non-independent slots — they stay synced to the (frozen) parent frame — so passing the real delta unconditionally is safe. When nothing ticks (isTicking), nothing advances.
Parameters
deltaMs
number
The elapsed time since the last frame in milliseconds.
Returns
void