Interface: SsPlayerProps
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:28
Everything about which animation and how it plays — as opposed to where it is drawn, which is SsPlacement.
Shared by <SpriteStudioView> and <SpriteStudioSprite> so the two cannot drift on what playing or animation mean. The split matches the components: a view fits one animation to itself, a sprite sits at a point in a scene, and everything else about them is identical.
Extended by
Properties
animation?
optionalanimation?:string
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:34
Which animation in the pack. Omitted, the pack's first one plays.
fit?
optionalfit?:SsFit
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:57
How the content box is scaled to the view. Default 'contain'.
frame?
optionalframe?:SsBox
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:59
The content box, in player-local units. Omitted, the animation's authored canvas.
frameScope?
optionalframeScope?:SsFrameScope
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:64
Measure the box instead of using the authored canvas — over this animation or the whole pack. Omitted, nothing is measured.
loop?
optionalloop?:number
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:54
How many times to play. Default 0, which is forever.
measureFrames?
optionalmeasureFrames?:number
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:66
Caps the measuring walk. Default 0, which is one authored cycle.
onAnimationChanged?
optionalonAnimationChanged?: (animation) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:105
A different animation was mounted. Not fired for a restart of the same one.
Parameters
animation
string
Returns
void
onAnimationFinished?
optionalonAnimationFinished?: (animation) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:99
The animation reached its end. Carries which one, since a player outlives them.
Parameters
animation
string
Returns
void
onAnimationLooped?
optionalonAnimationLooped?: (animation) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:101
The playhead crossed a loop boundary.
Parameters
animation
string
Returns
void
onAnimationStarted?
optionalonAnimationStarted?: (animation) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:103
Playback started from the beginning — not on resume.
Parameters
animation
string
Returns
void
onAudio?
optionalonAudio?: (event) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:83
Fires once per authored audio key the playhead crosses.
The event says what to play and where the file is — playing it is the app's job, since this package brings no audio stack of its own.
Parameters
event
Returns
void
onError?
optionalonError?: (error) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:97
Without one, the error goes to console.error rather than nowhere.
Parameters
error
unknown
Returns
void
onLoad?
optionalonLoad?: (player) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:95
The pack loaded and its animation is set up. Hands over the player, so reading getAnimationNames() needs neither the ref nor an effect.
Parameters
player
Returns
void
onSignal?
optionalonSignal?: (event) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:89
Fires once per active signal the playhead crosses — a named command and its parameters, for the app to dispatch. Signals switched off in the timeline are not reported.
Parameters
event
Returns
void
onUserData?
optionalonUserData?: (event) =>void
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:76
Fires once per authored user-data key the playhead crosses.
Parameters
event
Returns
void
parts?
optionalparts?:Readonly<Record<string,SsPartOverride>>
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:74
Per-part overrides on top of the animation, keyed by part name.
Declarative: a part dropped from the map goes back to the animation, so the prop describes the state rather than a history of calls.
playing?
optionalplaying?:boolean
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:50
Default true. false leaves it on its first frame.
source
source:
SsSource
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:30
The .ssab to play: a bundled asset, a file path or an http(s) URL.
speed?
optionalspeed?:number
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:52
Multiplier on the authored frame rate. Default 1.
textures?
optionaltextures?:SsTextureSources
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:32
Atlases supplied by the caller. A pack's own are loaded either way.
transitionMs?
optionaltransitionMs?:number
Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:48
Milliseconds to crossfade over when animation changes. Default 0, which switches outright — re-posing and heading out, as setAnimation does. Above 0 the change is a crossfade on track 0 instead: the outgoing animation fades while the incoming one plays from its head, and the other tracks stay. The first animation of a load is always set up outright.
With this prop in use, switch track 0 through animation rather than through the player's crossfade(0, …) / setTrackAnimation(0, …) / setAnimation: the prop only acts when it changes, so a clip reached behind its back is one the prop cannot then return from. The tracks above 0 are the player's alone.