Skip to content

Spine

Defined in: plugins/spine/pixi-spine/Spine.ts:156

The class to instantiate a Spine game object in Pixi. The static method Spine.from should be used to instantiate a Spine game object.

Extends

  • ViewContainer

Constructors

new Spine()

new Spine(options): Spine

Defined in: plugins/spine/pixi-spine/Spine.ts:237

Parameters

options

SpineOptions | SkeletonData

Returns

Spine

Overrides

ViewContainer.constructor

Properties

_didSpineUpdate

_didSpineUpdate: boolean = false

Defined in: plugins/spine/pixi-spine/Spine.ts:161


_slotsObject

readonly _slotsObject: Record<string, null | { container: Container; slot: Slot; }>

Defined in: plugins/spine/pixi-spine/Spine.ts:180


afterUpdateWorldTransforms()

afterUpdateWorldTransforms: (object) => void

Defined in: plugins/spine/pixi-spine/Spine.ts:166

Parameters

object

Spine

Returns

void


beforeUpdateWorldTransforms()

beforeUpdateWorldTransforms: (object) => void

Defined in: plugins/spine/pixi-spine/Spine.ts:163

Parameters

object

Spine

Returns

void


buildId

buildId: number = 0

Defined in: plugins/spine/pixi-spine/Spine.ts:159


skeleton

skeleton: Skeleton

Defined in: plugins/spine/pixi-spine/Spine.ts:172

The skeleton for this Spine game object.


skeletonBounds?

optional skeletonBounds: SkeletonBounds

Defined in: plugins/spine/pixi-spine/Spine.ts:175


spineAttachmentsDirty

spineAttachmentsDirty: boolean = true

Defined in: plugins/spine/pixi-spine/Spine.ts:195


spineTexturesDirty

spineTexturesDirty: boolean = true

Defined in: plugins/spine/pixi-spine/Spine.ts:196


state

state: AnimationState

Defined in: plugins/spine/pixi-spine/Spine.ts:174

The animation state for this Spine game object.

Accessors

autoUpdate

Get Signature

get autoUpdate(): boolean

Defined in: plugins/spine/pixi-spine/Spine.ts:222

Returns

boolean

Set Signature

set autoUpdate(value): void

Defined in: plugins/spine/pixi-spine/Spine.ts:226

When true, the Spine AnimationState and the Skeleton will be automatically updated using the Ticker.shared instance.

Parameters
value

boolean

Returns

void


bounds

Get Signature

get bounds(): Bounds

Defined in: plugins/spine/pixi-spine/Spine.ts:274

The local bounds of the view.

Returns

Bounds

Overrides

ViewContainer.bounds


debug

Get Signature

get debug(): undefined | ISpineDebugRenderer

Defined in: plugins/spine/pixi-spine/Spine.ts:203

Returns

undefined | ISpineDebugRenderer

Set Signature

set debug(value): void

Defined in: plugins/spine/pixi-spine/Spine.ts:210

Pass a SpineDebugRenderer or create your own ISpineDebugRenderer to render bones, meshes, …

Example
spineGO.debug = new SpineDebugRenderer();
Parameters
value

undefined | ISpineDebugRenderer

Returns

void

Methods

addSlotObject()

addSlotObject(slot, container): void

Defined in: plugins/spine/pixi-spine/Spine.ts:705

Attaches a PixiJS container to a specified slot. This will map the world transform of the slots bone to the attached container. A container can only be attached to one slot at a time.

Parameters

slot

string | number | Slot

container

Container

The container to attach to the slot

Returns

void


destroy()

destroy(options): void

Defined in: plugins/spine/pixi-spine/Spine.ts:825

Destroys this sprite renderable and optionally its texture.

Parameters

options

DestroyOptions = false

Options parameter. A boolean will act as if all options have been set to that value

Returns

void

Overrides

ViewContainer.destroy


getBonePosition()

getBonePosition(bone, outPos?): undefined | PointData

Defined in: plugins/spine/pixi-spine/Spine.ts:315

Return the position of the bone given in input into an IPointData.

Parameters

bone

string | Bone

outPos?

PointData

Returns

undefined | PointData

: the position of the bone, or undefined if no matching bone is found in the skeleton


getSlotObject()

getSlotObject(slot): undefined | Container

Defined in: plugins/spine/pixi-spine/Spine.ts:767

Returns a container attached to a slot, or undefined if no container is attached.

Parameters

slot

string | number | Slot

Returns

undefined | Container

  • The container attached to the slot

pixiWorldCoordinatesToBone()

pixiWorldCoordinatesToBone(point, bone): void

Defined in: plugins/spine/pixi-spine/Spine.ts:849

Converts a point from the Pixi world coordinate system to the bone’s local coordinate system.

Parameters

point
x

number

y

number

bone

Bone

Returns

void


pixiWorldCoordinatesToSkeleton()

pixiWorldCoordinatesToSkeleton(point): void

Defined in: plugins/spine/pixi-spine/Spine.ts:844

Converts a point from the Pixi world coordinate system to the skeleton coordinate system.

Parameters

point
x

number

y

number

Returns

void


removeSlotObject()

removeSlotObject(slotOrContainer): void

Defined in: plugins/spine/pixi-spine/Spine.ts:735

Removes a PixiJS container from the slot it is attached to.

Parameters

slotOrContainer

The container, slot id or slot to detach from

string | number | Container | Slot

Returns

void


setBonePosition()

setBonePosition(bone, position): void

Defined in: plugins/spine/pixi-spine/Spine.ts:288

Set the position of the bone given in input through a IPointData.

Parameters

bone

string | Bone

position

PointData

Returns

void

Throws

: if the given bone is not found in the skeleton, an error is thrown


skeletonToPixiWorldCoordinates()

skeletonToPixiWorldCoordinates(point): void

Defined in: plugins/spine/pixi-spine/Spine.ts:839

Converts a point from the skeleton coordinate system to the Pixi world coordinate system.

Parameters

point
x

number

y

number

Returns

void


update()

update(dt): void

Defined in: plugins/spine/pixi-spine/Spine.ts:264

If Spine.autoUpdate is false, this method allows to update the AnimationState and the Skeleton with the given delta.

Parameters

dt

number

Returns

void


from()

static from(options): Spine

Defined in: plugins/spine/pixi-spine/Spine.ts:872

Use this method to instantiate a Spine game object. Before instantiating a Spine game object, the skeleton (.skel or .json) and the atlas text files must be loaded into the Assets. For example:

PIXI.Assets.add("sackData", "./assets/sack-pro.skel");
PIXI.Assets.add("sackAtlas", "./assets/sack-pma.atlas");
await PIXI.Assets.load(["sackData", "sackAtlas"]);

Once a Spine game object is created, its skeleton data is cached into Cache using the key: ${skeletonAssetName}-${atlasAssetName}-${options?.scale ?? 1}

Parameters

options

SpineFromOptions

Options to configure the Spine game object. See SpineFromOptions

Returns

Spine

The Spine game object instantiated