Skip to content

Interface: SpriteStudioSpriteProps ​

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:11

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.

Extends ​

Properties ​

align? ​

optional align?: SsAlign

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:28


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.

Inherited from ​

SsPlayerProps.animation


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'.

Inherited from ​

SsPlayerProps.fit


flipX? ​

optional flipX?: boolean

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:29


flipY? ​

optional flipY?: boolean

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:30


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.

Inherited from ​

SsPlayerProps.frame


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.

Inherited from ​

SsPlayerProps.frameScope


height? ​

optional height?: number

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:27


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.

Inherited from ​

SsPlayerProps.loop


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.

Inherited from ​

SsPlayerProps.measureFrames


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

Inherited from ​

SsPlayerProps.onAnimationChanged


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

Inherited from ​

SsPlayerProps.onAnimationFinished


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

Inherited from ​

SsPlayerProps.onAnimationLooped


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

Inherited from ​

SsPlayerProps.onAnimationStarted


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

Inherited from ​

SsPlayerProps.onAudio


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

Inherited from ​

SsPlayerProps.onError


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

Inherited from ​

SsPlayerProps.onLoad


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

Inherited from ​

SsPlayerProps.onSignal


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

Inherited from ​

SsPlayerProps.onUserData


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.

Inherited from ​

SsPlayerProps.parts


playing? ​

optional playing?: boolean

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

Default true. false leaves it on its first frame.

Inherited from ​

SsPlayerProps.playing


scale? ​

optional scale?: number

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:32

Multiplier on top of the fit's scale, or the whole scale with no fit.


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.

Inherited from ​

SsPlayerProps.source


speed? ​

optional speed?: number

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

Multiplier on the authored frame rate. Default 1.

Inherited from ​

SsPlayerProps.speed


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.

Inherited from ​

SsPlayerProps.textures


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.

Inherited from ​

SsPlayerProps.transitionMs


width? ​

optional width?: number

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:26

The box to fit the art into, in scene pixels. Omit both for no fit at all, which is what scale alone wants.


x? ​

optional x?: number

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:20

Where the art goes, in scene pixels from the scene's top-left.

Which point of the art lands there depends on the rest: with a width and height it is the box those describe, positioned by align; without them there is no box to fit, so it is the animation's own origin — wherever the author put it.


y? ​

optional y?: number

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:21


z? ​

optional z?: number

Defined in: packages/react-native-spritestudio/src/view/SpriteStudioSprite.tsx:34

Draw order within the scene; ties break on mount order.