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
Section titled “Extends”ViewContainer
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Spine(
options
):Spine
Defined in: plugins/spine/pixi-spine/Spine.ts:237
Parameters
Section titled “Parameters”options
Section titled “options”SpineOptions
| SkeletonData
Returns
Section titled “Returns”Spine
Overrides
Section titled “Overrides”ViewContainer.constructor
Properties
Section titled “Properties”_didSpineUpdate
Section titled “_didSpineUpdate”_didSpineUpdate:
boolean
=false
Defined in: plugins/spine/pixi-spine/Spine.ts:161
_slotsObject
Section titled “_slotsObject”
readonly
_slotsObject:Record
<string
, {container
:Container
;slot
:Slot
; } |null
>
Defined in: plugins/spine/pixi-spine/Spine.ts:180
afterUpdateWorldTransforms()
Section titled “afterUpdateWorldTransforms()”afterUpdateWorldTransforms: (
object
) =>void
Defined in: plugins/spine/pixi-spine/Spine.ts:166
Parameters
Section titled “Parameters”object
Section titled “object”Spine
Returns
Section titled “Returns”void
beforeUpdateWorldTransforms()
Section titled “beforeUpdateWorldTransforms()”beforeUpdateWorldTransforms: (
object
) =>void
Defined in: plugins/spine/pixi-spine/Spine.ts:163
Parameters
Section titled “Parameters”object
Section titled “object”Spine
Returns
Section titled “Returns”void
buildId
Section titled “buildId”buildId:
number
=0
Defined in: plugins/spine/pixi-spine/Spine.ts:159
skeleton
Section titled “skeleton”skeleton:
Skeleton
Defined in: plugins/spine/pixi-spine/Spine.ts:172
The skeleton for this Spine game object.
skeletonBounds?
Section titled “skeletonBounds?”
optional
skeletonBounds:SkeletonBounds
Defined in: plugins/spine/pixi-spine/Spine.ts:175
spineAttachmentsDirty
Section titled “spineAttachmentsDirty”spineAttachmentsDirty:
boolean
=true
Defined in: plugins/spine/pixi-spine/Spine.ts:195
spineTexturesDirty
Section titled “spineTexturesDirty”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.
Accessors
Section titled “Accessors”autoUpdate
Section titled “autoUpdate”Get Signature
Section titled “Get Signature”get autoUpdate():
boolean
Defined in: plugins/spine/pixi-spine/Spine.ts:222
Returns
Section titled “Returns”boolean
Set Signature
Section titled “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
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
bounds
Section titled “bounds”Get Signature
Section titled “Get Signature”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.
Example
Section titled “Example”// Get bounds dimensionsconst bounds = view.bounds;console.log(`Width: ${bounds.maxX - bounds.minX}`);console.log(`Height: ${bounds.maxY - bounds.minY}`);
Bounds For bounds operations
Returns
Section titled “Returns”Bounds
The rectangular bounds of the view
Overrides
Section titled “Overrides”ViewContainer.bounds
Get Signature
Section titled “Get Signature”get debug():
undefined
|ISpineDebugRenderer
Defined in: plugins/spine/pixi-spine/Spine.ts:203
Returns
Section titled “Returns”undefined
| ISpineDebugRenderer
Set Signature
Section titled “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
Section titled “Example”spineGO.debug = new SpineDebugRenderer();
Parameters
Section titled “Parameters”undefined
| ISpineDebugRenderer
Returns
Section titled “Returns”void
Methods
Section titled “Methods”addSlotObject()
Section titled “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
Section titled “Parameters”string
| number
| Slot
container
Section titled “container”Container
The container to attach to the slot
Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”destroy(
options
):void
Defined in: plugins/spine/pixi-spine/Spine.ts:825
Destroys this sprite renderable and optionally its texture.
Parameters
Section titled “Parameters”options
Section titled “options”DestroyOptions
= false
Options parameter. A boolean will act as if all options have been set to that value
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”ViewContainer.destroy
getBonePosition()
Section titled “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
Section titled “Parameters”string
| Bone
outPos?
Section titled “outPos?”PointData
Returns
Section titled “Returns”undefined
| PointData
: the position of the bone, or undefined if no matching bone is found in the skeleton
getSlotObject()
Section titled “getSlotObject()”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.
Parameters
Section titled “Parameters”string
| number
| Slot
Returns
Section titled “Returns”undefined
| Container
<ContainerChild
>
- The container attached to the slot
pixiWorldCoordinatesToBone()
Section titled “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
Section titled “Parameters”number
number
Bone
Returns
Section titled “Returns”void
pixiWorldCoordinatesToSkeleton()
Section titled “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
Section titled “Parameters”number
number
Returns
Section titled “Returns”void
removeSlotObject()
Section titled “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
Section titled “Parameters”slotOrContainer
Section titled “slotOrContainer”The container, slot id or slot to detach from
string
| number
| Container
<ContainerChild
> | Slot
Returns
Section titled “Returns”void
setBonePosition()
Section titled “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
Section titled “Parameters”string
| Bone
position
Section titled “position”PointData
Returns
Section titled “Returns”void
Throws
Section titled “Throws”: if the given bone is not found in the skeleton, an error is thrown
skeletonToPixiWorldCoordinates()
Section titled “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
Section titled “Parameters”number
number
Returns
Section titled “Returns”void
update()
Section titled “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
Section titled “Parameters”number
Returns
Section titled “Returns”void
from()
Section titled “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
Section titled “Parameters”options
Section titled “options”SpineFromOptions
Options to configure the Spine game object. See SpineFromOptions
Returns
Section titled “Returns”Spine
The Spine game object instantiated