API Docs for: 0.1.0
Show:

CG.SpineAnimation Class

Extends CG.Entity TODO Boundingbox collision see example here: https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-libgdx/test/com/esotericsoftware/spine/AnimationStateTest.java Eventhandler see example here: https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-libgdx/test/com/esotericsoftware/spine/SkeletonTest.java Box2d support see example here: https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-libgdx/test/com/esotericsoftware/spine/Box2DExample.java http://www.esotericsoftware.com/forum/viewtopic.php?f=3&t=1394&p=6691&hilit=skeletonbounds#p6691
Module: CG

CG.SpineAnimation - this class is a little wrapper for spine animations (http://esotericsoftware.com). The implementation is not perfect at the moment and is on early stages. There is a lot of stuff that could be implemented: boundingbox collision, eventhandling, box2d support

Methods

draw

()

this method loops thru skeleton.drawOrder and renders all attachments of type spine.RegionAttachment.

init

(
  • options
)

Options: spinejson {string} Spine json animation file spineatlas {string} Spine atlas file (libGDX) position {CG.Point} scale {number} callback {function}

Parameters:

Example:

var sa = new CG.SpineAnimation({
                                                  spinejson: this.asset.getJsonByName('spinosaurus-json'),
                                                  spineatlas: this.asset.getTextByName('spinosaurus-atlas'),
                                                  position: new CG.Point(10,10),
                                                  scale: 1,
                                                  callback: function (spineObject) {
                                            

// spineObject.skeleton.setSkinByName("goblingirl"); spineObject.skeleton.setSlotsToSetupPose(); spineObject.state.setAnimationByName(0, "animation", true); } })

initSkeleton

()

initialises the animation (skeleton, stateData,. ,.) after preloading and calls the callback for custom animation configuration (.setSkinByName(), .setAnimationByName(),. ,.).

updateDiff

()

waitForTextures

()

Properties

initCustom

Object

this is used for a callback for custom spine initialization.

skeleton

spine.Skeleton

skeletonJson

spine.SkeletonJson

skeletonposition

CG.Point

initial position for the animation. later position changes at the moment with: obj.skeleton.getRootBone().x and obj.skeleton.getRootBone().y. maybe a TODO for a method ;o)

spineAtlas

Object

this is used for a callback for custom animation configuration.

spineAtlasData

String

data from generated atlas text file. at the moment only the libGDX Format is supported from the spine-js runtime.

spineJsonData

Object

spine animation json data loaded and parsed thru MediaAsset.

spineJsonData

Object

state

spine.AnimationState

stateData

spine.AnimationStateData

textureCount

Number

counter for the spine image preloader

xscale

Number

spine bone xscale

yscale

Number

spine bone yscale