Cocos Creator API

1.3.0

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

Skeleton

: 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.)

paused Boolean readOnly

The skeletal animation is paused?

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

premultipliedAlpha Boolean

Indicates whether to enable premultiplied alpha. You should disable this option when image's transparent area appears to have opaque pixels, or enable this option when image's half transparent area appears to be darken.

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

updateWorldTransform ( )

Computes the world SRT from the local SRT for each bone.

:

var bone = spine.findBone('head');
cc.log(bone.worldX); // return 0;
spine.updateWorldTransform();
bone = spine.findBone('head');
cc.log(bone.worldX); // return -23.12;

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
)
sp.spine.Bone

Finds a bone by name. This does a string comparison for every bone.
Returns a sp.spine.Bone object.

boneName String

:

: sp.spine.Bone

findSlot
(
  • slotName
)
sp.spine.Slot

Finds a slot by name. This does a string comparison for every slot.
Returns a sp.spine.Slot object.

slotName String

:

: sp.spine.Slot

setSkin
(
  • skinName
)
sp.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.
Returns a sp.spine.Skin object.

skinName String

:

: sp.spine.Skin

getAttachment
(
  • slotName
  • attachmentName
)
sp.spine.Attachment

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

slotName String
attachmentName String

:

: sp.spine.Attachment

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.

slotName String
attachmentName String

setSkeletonData
(
  • skeletonData
  • ownsSkeletonData
)

Sets skeleton data to sp.Skeleton.

skeletonData sp.spine.SkeletonData
ownsSkeletonData sp.spine.SkeletonData

setAnimationStateData
(
  • stateData
)

Sets animation state data.
The parameter type is sp.spine.AnimationStateData.

stateData sp.spine.AnimationStateData

setMix
(
  • fromAnimation
  • toAnimation
  • duration
)

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

fromAnimation String
toAnimation String
duration Number

setAnimationListener
(
  • target
  • callback
)

Sets event listener.

target Object
callback Function

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

Set the current animation. Any queued animations are cleared.
Returns a sp.spine.TrackEntry object.

trackIndex Number
name String
loop Boolean

:

: sp.spine.TrackEntry

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

Adds an animation to be played delay seconds after the current or last queued animation.
Returns a sp.spine.TrackEntry object.

trackIndex Number
name String
loop Boolean
delay optional Number 0

:

: sp.spine.TrackEntry

getCurrent
(
  • trackIndex
)
sp.spine.TrackEntry

Returns track entry by trackIndex.
Returns a sp.spine.TrackEntry object.

trackIndex Unknown

:

: sp.spine.TrackEntry

clearTracks ( )

Clears all tracks of animation state.

clearTrack
(
  • trackIndex
)

Clears track of animation state by trackIndex.

trackIndex number

setStartListener
(
  • listener
)

Set the start event listener.

listener function

setEndListener
(
  • listener
)

Set the end event listener.

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