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.

  • ViewContainer

new Spine(options): Spine

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

SpineOptions | SkeletonData

Spine

ViewContainer.constructor

_didSpineUpdate: boolean = false

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


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

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


afterUpdateWorldTransforms: (object) => void

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

Spine

void


beforeUpdateWorldTransforms: (object) => void

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

Spine

void


buildId: number = 0

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


skeleton: Skeleton

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

The skeleton for this Spine game object.


optional skeletonBounds: SkeletonBounds

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


spineAttachmentsDirty: boolean = true

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


spineTexturesDirty: boolean = true

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


state: AnimationState

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

The animation state for this Spine game object.

get autoUpdate(): boolean

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

boolean

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.

boolean

void


get bounds(): Bounds

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

The local bounds of the view in its own coordinate space. Bounds are automatically updated when the view’s content changes.

// Get bounds dimensions
const bounds = view.bounds;
console.log(`Width: ${bounds.maxX - bounds.minX}`);
console.log(`Height: ${bounds.maxY - bounds.minY}`);

Bounds For bounds operations

Bounds

The rectangular bounds of the view

ViewContainer.bounds


get debug(): undefined | ISpineDebugRenderer

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

undefined | ISpineDebugRenderer

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, …

spineGO.debug = new SpineDebugRenderer();

undefined | ISpineDebugRenderer

void

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.

string | number | Slot

Container

The container to attach to the slot

void


destroy(options): void

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

Destroys this sprite renderable and optionally its texture.

DestroyOptions = false

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

void

ViewContainer.destroy


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.

string | Bone

PointData

undefined | PointData

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


getSlotObject(slot): undefined | Container<ContainerChild>

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

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

string | number | Slot

undefined | Container<ContainerChild>

  • The container attached to the slot

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.

number

number

Bone

void


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.

number

number

void


removeSlotObject(slotOrContainer): void

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

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

The container, slot id or slot to detach from

string | number | Container<ContainerChild> | Slot

void


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.

string | Bone

PointData

void

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


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.

number

number

void


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.

number

void


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}

SpineFromOptions

Options to configure the Spine game object. See SpineFromOptions

Spine

The Spine game object instantiated