Class sp.SkeletonAnimation

Class Summary
Constructor Attributes Constructor Name and Description
 
The skeleton animation of spine.

Method Summary

Class Detail

sp.SkeletonAnimation()
The skeleton animation of spine. It updates animation's state and skeleton's world transform.
var spineBoy = new sp.SkeletonAnimation('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas');
this.addChild(spineBoy, 4);

Method Detail

  • {spine.TrackEntry|null} addAnimation(trackIndex, name, loop, delay)
    Adds an animation to be played delay seconds after the current or last queued animation.
    Parameters:
    {Number} trackIndex
    {String} name
    {Boolean} loop
    {Number} delay
    Returns:
    {spine.TrackEntry|null}
  • clearTrack(trackIndex)
    Clears track of animation state by trackIndex.
    Parameters:
    {Number} trackIndex
  • clearTracks()
    Clears all tracks of animation state.
  • <static> {sp.Skeleton} sp.SkeletonAnimation.create(skeletonDataFile, atlasFile, scale)
    Creates a skeleton animation 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.SkeletonAnimation(skeletonDataFile, atlasFile, scale) instead.
    Returns:
    {sp.Skeleton}
  • {spine.TrackEntry|null} getCurrent(trackIndex)
    Returns track entry by trackIndex.
    Parameters:
    trackIndex
    Returns:
    {spine.TrackEntry|null}
  • init()
    Initializes a sp.SkeletonAnimation. please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
  • {spine.TrackEntry|null} setAnimation(trackIndex, name, loop)
    Set the current animation. Any queued animations are cleared.
    Parameters:
    {Number} trackIndex
    {String} name
    {Boolean} loop
    Returns:
    {spine.TrackEntry|null}
  • setAnimationListener(target, callback)
    Sets event listener of sp.SkeletonAnimation.
    Parameters:
    {Object} target
    {Function} callback
  • setAnimationStateData(stateData)
    Sets animation state data to sp.SkeletonAnimation.
    Parameters:
    {spine.AnimationStateData} stateData
  • setMix(fromAnimation, toAnimation, duration)
    Mix applies all keyframe values, interpolated for the specified time and mixed with the current values.
    Parameters:
    {String} fromAnimation
    {String} toAnimation
    {Number} duration
  • update(dt)
    Update will be called automatically every frame if "scheduleUpdate" is called when the node is "live". It updates animation's state and skeleton's world transform.
    Parameters:
    {Number} dt
    Delta time since last update