CG.SpineAnimation Class
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
Item Index
Methods
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:
-
options
Object
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(),. ,.).
update
()
updateDiff
()
waitForTextures
()
Properties
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)
spineAtlasData
String
data from generated atlas text file. at the moment only the libGDX Format is supported from the spine-js runtime.