Class sp.Skeleton

Class Summary
Constructor Attributes Constructor Name and Description
 

The skeleton of Spine.

Method Summary

Class Detail

sp.Skeleton()

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

Method Detail

  • <static> {sp.Skeleton} sp.Skeleton.create(skeletonDataFile, atlasFile, scale)
    Creates a skeleton object.
    Parameters:
    {spine.SkeletonData|String} skeletonDataFile
    {String|spine.Atlas|spine.SkeletonData} atlasFile
    atlas filename or atlas data or owns SkeletonData
    {Number} scale Optional
    scale can be specified on the JSON or binary loader which will scale the bone positions, image sizes, and animation translations.
    Deprecated:
    since v3.0, please use new sp.Skeleton(skeletonDataFile, atlasFile, scale) instead.
    Returns:
    {sp.Skeleton}
  • ctor(skeletonDataFile, atlasFile, scale)
    The constructor of sp.Skeleton. override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
    Parameters:
    skeletonDataFile
    atlasFile
    scale
  • {spine.Bone} findBone(boneName)
    Finds a bone by name. This does a string comparison for every bone.
    Parameters:
    {String} boneName
    Returns:
    {spine.Bone}
  • {spine.Slot} findSlot(slotName)
    Finds a slot by name. This does a string comparison for every slot.
    Parameters:
    {String} slotName
    Returns:
    {spine.Slot}
  • {spine.RegionAttachment|spine.BoundingBoxAttachment} getAttachment(slotName, attachmentName)
    Returns the attachment for the slot and attachment name. The skeleton looks first in its skin, then in the skeleton data’s default skin.
    Parameters:
    {String} slotName
    {String} attachmentName
    Returns:
    {spine.RegionAttachment|spine.BoundingBoxAttachment}
  • {cc.BlendFunc} getBlendFunc()
    Returns the blendFunc of sp.Skeleton.
    Returns:
    {cc.BlendFunc}
  • {cc.Rect} getBoundingBox()
    Returns the bounding box of sp.Skeleton.
    Returns:
    {cc.Rect}
  • {boolean} getDebugBonesEnabled()
    Gets whether open debug bones.
    Returns:
    {boolean} true to open, false to close.
  • {boolean} getDebugSlotsEnabled()
    Gets whether open debug slots.
    Returns:
    {boolean} true to open, false to close.
  • {cc.Node} getTextureAtlas(regionAttachment)
    Return the renderer of attachment.
    Parameters:
    {spine.RegionAttachment|spine.BoundingBoxAttachment} regionAttachment
    Returns:
    {cc.Node}
  • init()
    Initializes a sp.Skeleton. please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
  • initWithArgs(skeletonDataFile, atlasFile, scale)
    Initializes sp.Skeleton with Data.
    Parameters:
    {spine.SkeletonData|String} skeletonDataFile
    {String|spine.Atlas|spine.SkeletonData} atlasFile
    atlas filename or atlas data or owns SkeletonData
    {Number} scale Optional
    scale can be specified on the JSON or binary loader which will scale the bone positions, image sizes, and animation translations.
  • {boolean} isOpacityModifyRGB()
    Returns whether to enable premultiplied alpha.
    Returns:
    {boolean}
  • 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.
    Parameters:
    {String} slotName
    {String} attachmentName
  • setBlendFunc(src, dst)
    Sets the blendFunc of sp.Skeleton.
    Parameters:
    {cc.BlendFunc|Number} src
    {Number} dst Optional
  • setBonesToSetupPose()
    Sets the bones to the setup pose, using the values from the `BoneData` list in the `SkeletonData`.
  • setDebugBones(enable)
    Sets whether open debug bones.
    Parameters:
    {boolean} enable
  • setDebugBonesEnabled(enabled)
    Sets whether open debug bones.
    Parameters:
    {boolean} enabled
  • setDebugSlotsEnabled(enabled)
    Sets whether open debug slots.
    Parameters:
    {boolean} enabled
    true to open, false to close.
  • setDebugSolots(enable)
    Sets whether open debug slots.
    Parameters:
    {boolean} enable
    true to open, false to close.
  • setOpacityModifyRGB(alpha)
    Sets the premultiplied alpha value to sp.Skeleton.
    Parameters:
    {Number} alpha
  • setSkeletonData(skeletonData, ownsSkeletonData)
    Sets skeleton data to sp.Skeleton.
    Parameters:
    {spine.SkeletonData} skeletonData
    {spine.SkeletonData} ownsSkeletonData
  • {spine.Skin} setSkin(skinName)
    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.
    Parameters:
    {string} skinName
    Returns:
    {spine.Skin}
  • setSlotsToSetupPose()
    Sets the slots to the setup pose, using the values from the `SlotData` list in the `SkeletonData`.
  • setTimeScale(scale)
    Sets the time scale of sp.Skeleton.
    Parameters:
    {Number} scale
  • setToSetupPose()
    Sets the bones and slots to the setup pose.
  • update(dt)
    Update will be called automatically every frame if "scheduleUpdate" is called when the node is "live".
    Parameters:
    {Number} dt
    Delta time since last update
  • updateWorldTransform()
    Computes the world SRT from the local SRT for each bone.