Class ccs.Armature

Class Summary
Constructor Attributes Constructor Name and Description
 
The main class of Armature, it plays armature animation, manages and updates bones' state.

Method Summary

Class Detail

ccs.Armature()
The main class of Armature, it plays armature animation, manages and updates bones' state.

Field Detail

{ccs.ArmatureAnimation} animation
- The animation
{ccs.ArmatureData} armatureData
- The armature data
{cc.SpriteBatchNode} batchNode
- The batch node of the armature
{Object} body
- The body of the armature
{ccs.ColliderFilter} colliderFilter
- <@writeonly> The collider filter of the armature
{String} name
- The name of the armature
{ccs.Bone} parentBone
- The parent bone of the armature node
{Number} version
- The version

Method Detail

  • addBone(bone, parentName)
    Add a Bone to this Armature
    Parameters:
    {ccs.Bone} bone
    The Bone you want to add to Armature
    {String} parentName
    The parent Bone's name you want to add to. If it's null, then set Armature to its parent
  • changeBoneParent(bone, parentName)
    Change a bone's parent with the specified parent name.
    Parameters:
    {ccs.Bone} bone
    The bone you want to change parent
    {String} parentName
    The new parent's name
  • <static> {ccs.Armature} ccs.Armature.create(name, parentBone)
    Allocates an armature, and use the ArmatureData named name in ArmatureDataManager to initializes the armature.
    // example
    var armature = ccs.Armature.create();
    Parameters:
    {String} name Optional
    Bone name
    {ccs.Bone} parentBone Optional
    the parent bone
    Returns:
    {ccs.Armature}
  • {ccs.Bone} createBone(boneName)
    create a bone with name
    Parameters:
    {String} boneName
    Returns:
    {ccs.Bone}
  • ctor(name, parentBone)
    Create a armature node. Constructor of ccs.Armature
    var armature = new ccs.Armature();
    Parameters:
    {String} name
    {ccs.Bone} parentBone
  • draw(ctx)
    Draws armature's display render node.
    Parameters:
    {CanvasRenderingContext2D | WebGLRenderingContext} ctx
    The render context
  • drawContour()
    draw contour
  • {cc.Point} getAnchorPointInPoints()
    Returns the anchor point in points of ccs.Armature.
    Returns:
    {cc.Point}
  • {ccs.ArmatureAnimation} getAnimation()
    Gets the animation of this Armature.
    Returns:
    {ccs.ArmatureAnimation}
  • {ccs.ArmatureData} getArmatureData()
    Returns the armatureData of ccs.Armature
    Returns:
    {ccs.ArmatureData}
  • {Boolean} getArmatureTransformDirty()
    armatureTransformDirty getter
    Returns:
    {Boolean}
  • {cc.BlendFunc} getBlendFunc()
    Returns the blendFunc of ccs.Armature
    Returns:
    {cc.BlendFunc}
  • {ccs.Bone} getBone(name)
    Gets a bone with the specified name
    Parameters:
    {String} name
    The bone's name you want to get
    Returns:
    {ccs.Bone}
  • {ccs.Bone} getBoneAtPoint(x, y)
    when bone contain the point ,then return it.
    Parameters:
    {Number} x
    {Number} y
    Returns:
    {ccs.Bone}
  • {Object} getBoneDic()
    Get CCArmature's bone dictionary
    Returns:
    {Object} Armature's bone dictionary
  • {cc.Rect} getBoundingBox()
    This boundingBox will calculate all bones' boundingBox every time
    Returns:
    {cc.Rect}
  • {ccs.Bone} getParentBone()
    Return parent bone of ccs.Armature.
    Returns:
    {ccs.Bone}
  • {Number} getVersion()
    version getter
    Returns:
    {Number}
  • {Boolean} init(name, parentBone)
    Initializes a CCArmature with the specified name and CCBone
    Parameters:
    {String} name Optional
    {ccs.Bone} parentBone Optional
    Returns:
    {Boolean}
  • onEnter()
    The callback when ccs.Armature enter stage.
  • onExit()
    The callback when ccs.Armature exit stage.
  • removeBone(bone, recursion)
    Remove a bone with the specified name. If recursion it will also remove child Bone recursively.
    Parameters:
    {ccs.Bone} bone
    The bone you want to remove
    {Boolean} recursion
    Determine whether remove the bone's child recursion.
  • setAnchorPoint(point, y)
    Sets armature's anchor point, because it need to consider offset point, so here is the override function.
    Parameters:
    {cc.Point|Number} point
    point or x of point
    {Number} y Optional
    y of point
  • setAnimation(animation)
    Sets animation to this Armature
    Parameters:
    {ccs.ArmatureAnimation} animation
  • setArmatureData(armatureData)
    Sets armatureData to this Armature
    Parameters:
    {ccs.ArmatureData} armatureData
  • setBlendFunc(blendFunc)
    Sets the blendFunc to ccs.Armature
    Parameters:
    {cc.BlendFunc} blendFunc
  • setColliderFilter(filter)
    set collider filter
    Parameters:
    {ccs.ColliderFilter} filter
  • setParentBone(parentBone)
    Sets parent bone of this Armature
    Parameters:
    {ccs.Bone} parentBone
  • setVersion(version)
    version setter
    Parameters:
    {Number} version
  • update(dt)
    The update callback of ccs.Armature, it updates animation's state and updates bone's state.
    Parameters:
    {Number} dt
  • updateOffsetPoint()
    Set contentSize and Calculate anchor point.