Skip to content

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? ​

optional animation?: 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? ​

optional fit?: SsFit

Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:57

How the content box is scaled to the view. Default 'contain'.


frame? ​

optional frame?: 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? ​

optional frameScope?: 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? ​

optional loop?: number

Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:54

How many times to play. Default 0, which is forever.


measureFrames? ​

optional measureFrames?: number

Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:66

Caps the measuring walk. Default 0, which is one authored cycle.


onAnimationChanged? ​

optional onAnimationChanged?: (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? ​

optional onAnimationFinished?: (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? ​

optional onAnimationLooped?: (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? ​

optional onAnimationStarted?: (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? ​

optional onAudio?: (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 ​

SsAudioEvent

Returns ​

void


onError? ​

optional onError?: (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? ​

optional onLoad?: (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 ​

SpriteStudioPlayer

Returns ​

void


onSignal? ​

optional onSignal?: (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 ​

SsSignalEvent

Returns ​

void


onUserData? ​

optional onUserData?: (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 ​

SsUserDataEvent

Returns ​

void


parts? ​

optional parts?: 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? ​

optional playing?: 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? ​

optional speed?: number

Defined in: packages/react-native-spritestudio/src/view/useSpriteStudioPlayer.ts:52

Multiplier on the authored frame rate. Default 1.


textures? ​

optional textures?: 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? ​

optional transitionMs?: 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.