Class ccs.ArmatureAnimation

Class Summary
Constructor Attributes Constructor Name and Description
 
The Animation class for Armature, it plays armature animation, and controls speed scale and manages animation frame.

Method Summary

Class Detail

ccs.ArmatureAnimation()
The Animation class for Armature, it plays armature animation, and controls speed scale and manages animation frame.

Field Detail

{ccs.AnimationData} animationData
- Animation data
{Number} animationScale
- Animation play speed scale
{Boolean} ignoreFrameEvent
- Indicate whether the frame event is ignored
{Number} speedScale
- Animation play speed scale
{Object} userObject
- User custom object

Method Detail

  • <static> {ccs.ArmatureAnimation} ccs.ArmatureAnimation.create(armature)
    Allocates and initializes a ArmatureAnimation.
    // example
    var animation = ccs.ArmatureAnimation.create();
    Parameters:
    armature
    Returns:
    {ccs.ArmatureAnimation}
  • ctor()
    The Construction of ccs.ArmatureAnimation
  • frameEvent(bone, frameEventName, originFrameIndex, currentFrameIndex)
    Emits a frame event
    Parameters:
    {ccs.Bone} bone
    {String} frameEventName
    {Number} originFrameIndex
    {Number} currentFrameIndex
  • {ccs.AnimationData} getAnimationData()
    Returns animation data of animation.
    Returns:
    {ccs.AnimationData}
  • {Number} getAnimationScale()
    Returns animation play speed scale.
    Deprecated:
    since v3.0, please use getSpeedScale instead.
    Returns:
    {Number}
  • {String} getCurrentMovementID()
    Returns the Id of current movement
    Returns:
    {String}
  • {Number} getMovementCount()
    Returns the length of armature's movements
    Returns:
    {Number}
  • {Number} getSpeedScale()
    Returns animation play speed scale.
    Returns:
    {Number}
  • {Object} getUserObject()
    Returns the user object of animation.
    Returns:
    {Object}
  • gotoAndPause(frameIndex)
    Goes to specified frame and pauses current movement.
    Parameters:
    {Number} frameIndex
  • gotoAndPlay(frameIndex)

    Goes to specified frame and plays current movement.
    You need first switch to the movement you want to play, then call this function.

    example : playByIndex(0);
    gotoAndPlay(0);
    playByIndex(1);
    gotoAndPlay(0);
    gotoAndPlay(15);

    Parameters:
    {Number} frameIndex
  • {Boolean} init(armature)
    Initializes with an armature object
    Parameters:
    {ccs.Armature} armature
    Returns:
    {Boolean}
  • {boolean} isIgnoreFrameEvent()
    Determines if the frame event is ignored
    Returns:
    {boolean}
  • movementEvent(armature, movementType, movementID)
    Emits a movement event
    Parameters:
    {ccs.Armature} armature
    {Number} movementType
    {String} movementID
  • pause()
    Pauses armature animation.
  • play(animationName, durationTo, loop)
    play animation by animation name.
    // example
    armature.getAnimation().play("run",-1,1);//loop play
    armature.getAnimation().play("run",-1,0);//not loop play
    Parameters:
    {String} animationName
    The animation name you want to play
    {Number} durationTo Optional, Default: -1
    he frames between two animation changing-over.It's meaning is changing to this animation need how many frames -1 : use the value from CCMovementData get from flash design panel
    {Number} loop Optional, Default: -1
    Whether the animation is loop. loop < 0 : use the value from CCMovementData get from flash design panel loop = 0 : this animation is not loop loop > 0 : this animation is loop
  • playByIndex(animationIndex, durationTo, durationTween, loop, tweenEasing)
    Plays animation with index, the other param is the same to play.
    Parameters:
    {Number} animationIndex
    {Number} durationTo
    {Number} durationTween
    {Number} loop
    {Number} tweenEasing Optional
    Deprecated:
    since v3.0, please use playWithIndex instead.
  • playWithIndex(animationIndex, durationTo, loop)
    Plays animation with index, the other param is the same to play.
    Parameters:
    {Number|Array} animationIndex
    {Number} durationTo
    {Number} loop
  • playWithIndexes(movementIndexes, durationTo, loop)
    Plays animation by indexes
    Parameters:
    {Array} movementIndexes
    {Number} durationTo
    {Boolean} loop
  • playWithNames(movementNames, durationTo, loop)
    Plays animation with names
    Parameters:
    {Array} movementNames
    {Number} durationTo
    {Boolean} loop
  • resume()
    Resumes armature animation.
  • setAnimationData(data)
    Sets animation data to animation.
    Parameters:
    {ccs.AnimationData} data
  • setAnimationScale(animationScale)
    Sets animation play speed scale.
    Parameters:
    {Number} animationScale
    Deprecated:
    since v3.0, please use setSpeedScale instead.
  • setFrameEventCallFunc(callFunc, target)
    Sets frame event callback to animation.
    Parameters:
    {function} callFunc
    {Object} target
  • setMovementEventCallFunc(callFunc, target)
    Sets movement event callback to animation.
    Parameters:
    {function} callFunc
    {Object} target
  • setSpeedScale(speedScale)
    Sets animation play speed scale.
    Parameters:
    {Number} speedScale
  • setUserObject(userObject)
    Sets user object to animation.
    Parameters:
    {Object} userObject
  • stop()
    Stops armature animation.
  • update(dt)
    Updates the state of ccs.Tween list, calls frame event's callback and calls movement event's callback.
    Parameters:
    {Number} dt
  • updateHandler()
    Updates will call this handler, you can handle your logic here
  • updateMovementList()
    Updates movement list.