Skip to content

Function: useSsPartTransform() ​

useSsPartTransform(player, partName): SharedValue<SsPartScreenTransform>

Defined in: packages/react-native-spritestudio/src/view/useSsPartTransform.ts:47

Follows a part with a Reanimated shared value — a health bar over a head, a spark at a muzzle, a React view pinned to a hand.

Sampled on the JS thread, once per frame the player shows (player/frames), and published into a shared value, so the consumer runs on the UI thread even though the sample does not. A player that stands still shows no new frame, and is not read. The frame loop, the Brain and the whole player are JS-thread, so a hook that claimed to sample in a worklet would be sampling a value the JS thread had already moved on from.

The reported transform is in view pixels, root transform applied, because that is the space an Animated.View on top of the canvas lives in.

Position, rotation and scale only — never Skew: a part's Skew is a non-inheriting local-vertex deform that stays out of the world matrix, so a follower is not sheared even when it rides a sheared part (or one under a sheared parent), matching SpriteStudio.

Parameters ​

player ​

SpriteStudioPlayer | null

partName ​

string

Returns ​

SharedValue<SsPartScreenTransform>