Cocos Creator API

1.0.0

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

Skeleton

Module: sp

The skeleton of Spine

(Skeleton has a reference to a SkeletonData and stores the state for skeleton instance, which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible.
Multiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.)

Properties

skeletonData SkeletonData

The skeleton data contains the skeleton information (bind pose bones, slots, draw order, attachments, skins, etc) and animations but does not hold any state.
Multiple skeletons can share the same skeleton data.

defaultSkin String

The name of default skin.

defaultAnimation String

The name of default animation.

animation String

The name of current playing animation.

_defaultSkinIndex Number

loop Boolean

TODO

timeScale Number

The time scale of this skeleton.

debugSlots Boolean

Indicates whether open debug slots.

debugBones Boolean

Indicates whether open debug bones.

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

setToSetupPose ( )

Sets the bones and slots to the setup pose.

setBonesToSetupPose ( )

Sets the bones to the setup pose, using the values from the BoneData list in the SkeletonData.

setSlotsToSetupPose ( )

Sets the slots to the setup pose, using the values from the SlotData list in the SkeletonData.

findBone
(
  • boneName
)
spine.Bone

Finds a bone by name. This does a string comparison for every bone.

name type description
boneName String

returns:

type: spine.Bone

findSlot
(
  • slotName
)
spine.Slot

Finds a slot by name. This does a string comparison for every slot.

name type description
slotName String

returns:

type: spine.Slot

setSkin
(
  • skinName
)
spine.Skin

Finds a skin by name and makes it the active skin. This does a string comparison for every skin. Note that setting the skin does not change which attachments are visible.

name type description
skinName String

returns:

type: spine.Skin

getAttachment
(
  • slotName
  • attachmentName
)
spine.RegionAttachment | sp.spine.BoundingBoxAttachment

Returns the attachment for the slot and attachment name. The skeleton looks first in its skin, then in the skeleton data’s default skin.

name type description
slotName String
attachmentName String

returns:

type: spine.RegionAttachment | sp.spine.BoundingBoxAttachment

setAttachment
(
  • slotName
  • attachmentName
)

Sets the attachment for the slot and attachment name. The skeleton looks first in its skin, then in the skeleton data’s default skin.

name type description
slotName String
attachmentName String

setSkeletonData
(
  • skeletonData
  • ownsSkeletonData
)

Sets skeleton data to sp.Skeleton.

name type description
skeletonData spine.SkeletonData
ownsSkeletonData spine.SkeletonData

setAnimationStateData
(
  • stateData
)

Sets animation state data.

name type description
stateData spine.AnimationStateData

setMix
(
  • fromAnimation
  • toAnimation
  • duration
)

Mix applies all keyframe values, interpolated for the specified time and mixed with the current values.

name type description
fromAnimation String
toAnimation String
duration Number

setAnimationListener
(
  • target
  • callback
)

Sets event listener.

name type description
target Object
callback Function

setAnimation
(
  • trackIndex
  • name
  • loop
)
spine.TrackEntry

Set the current animation. Any queued animations are cleared.

name type description
trackIndex Number
name String
loop Boolean

returns:

type: spine.TrackEntry

addAnimation
(
  • trackIndex
  • name
  • loop
  • [delay =0]
)
spine.TrackEntry

Adds an animation to be played delay seconds after the current or last queued animation.

name type description
trackIndex Number
name String
loop Boolean
delay optional Number 0

returns:

type: spine.TrackEntry

getCurrent
(
  • trackIndex
)
spine.TrackEntry

Returns track entry by trackIndex.

name type description
trackIndex Unknown

returns:

type: spine.TrackEntry

clearTracks ( )

Clears all tracks of animation state.

clearTrack
(
  • trackIndex
)

Clears track of animation state by trackIndex.

name type description
trackIndex number

setStartListener
(
  • listener
)

Set the start event listener.

name type description
listener function

setEndListener
(
  • listener
)

Set the end event listener.

name type description
listener function

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index