Interface: SpriteStudioPlayerApi
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:53
The transport surface, with no drawing backend in it.
Stated as an interface so the Layer 4 prop types and this API are shared without a drawing backend. Anything Skia-shaped belongs on the class below, not here.
Properties
currentAnimation
readonlycurrentAnimation:string|null
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:59
frameNo
readonlyframeNo:number
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:54
isFinished
readonlyisFinished:boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:56
isPlaying
readonlyisPlaying:boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:55
isPlayingForward
readonlyisPlayingForward:boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:58
Whether the playhead is travelling forward this frame. Gate audio on it.
Methods
advance()
advance(
dtMilliseconds):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:130
Advances the clock by dtMilliseconds. The default drive — see the class comment. Milliseconds is the Brain's unit and is carried unconverted through every layer, so there is no seam for a 1000x to hide in.
Parameters
dtMilliseconds
number
Returns
void
getAnimationNames()
getAnimationNames():
string[]
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:87
Every animation in the loaded pack, in the order the .ssab lists them.
Empty until a load finishes, so a caller building a picker off it should read it from onLoad rather than on mount. The names are exactly what setAnimation takes — there is no separate id, which is why this is worth exposing rather than making callers hard-code a list that the next conversion can invalidate.
Returns
string[]
pause()
pause():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:69
Holds playback where it stands. Idempotent, ignored while nothing plays.
Returns
void
play()
play(
startFrame?):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:67
Head-out. Rewinds to the start of the section and re-arms the loop count — it is not a resume, and using it to lift a pause() sends the playhead back to the start. That is the Brain's contract, and these four verbs are kept distinct here.
Parameters
startFrame?
number
Returns
void
resume()
resume():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:74
Lifts a pause, carrying on from the same frame. Idempotent, and a no-op on a stopped animation — starting one is play's job.
Returns
void
seek()
seek(
frameNo):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:88
Parameters
frameNo
number
Returns
void
setAnimation()
setAnimation(
name):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:77
Parameters
name
string
Returns
boolean
setAnimationSection()
setAnimationSection(
startFrame,endFrame):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:102
Restricts playback to [startFrame, endFrame] of the current animation. Returns false, and warns once per pair, when it did nothing.
Parameters
startFrame
number
endFrame
number
Returns
boolean
setAnimationSectionByLabel()
setAnimationSectionByLabel(
startLabel,endLabel,startOffset?,endOffset?):boolean
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:104
setAnimationSection with the ends named by labels of the current animation.
Parameters
startLabel
string
endLabel
string
startOffset?
number
endOffset?
number
Returns
boolean
setFrameRate()
setFrameRate(
fps):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:119
Overrides the advance rate, in absolute frames per second. 0 clears the override and hands playback back to whatever each animation was authored at.
Parameters
fps
number
Returns
void
setFrameSkipEnabled()
setFrameSkipEnabled(
enabled):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:114
Whether a long tick may skip frames to stay on the wall clock (the default) or advance exactly one frame, stretching playback instead.
Parameters
enabled
boolean
Returns
void
setLoopCount()
setLoopCount(
loops):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:97
0 = infinite.
Parameters
loops
number
Returns
void
setSpeedScale()
setSpeedScale(
rate):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:95
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
setSubFrameEnabled()
setSubFrameEnabled(
enabled):void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:124
Sub-frame interpolation, on by default: whether what is drawn may sit between two authored frames.
Parameters
enabled
boolean
Returns
void
stop()
stop():
void
Defined in: packages/react-native-spritestudio/src/player/SpriteStudioPlayer.ts:76
Ends playback. Nothing rewinds; the frame it stopped on stays on screen.
Returns
void