-
EydamsonLikes 0Problem Description
Hi!
Can you show me an example on how to use the skeletal animation made with cocostudio..
So far I already made the animation, and when I export it it has only the .json file,
but when i added it in a scene it is not animating..
I have a daragon.csd that hast the animation
then a dragonLayer.csd that has a background and the animated sprite(dragon.csd) inside it..is it seems like it is not automatically animating..
how can I access this animation and play it?..
can you guys show me an example? I have search the net but their examples are already deprecated.. thanks!and btw when i said skeleton/skeletal, what i mean is bone.. i dont know if it is different with armature.. cuz when i drag the armature in to the scene it just a single sprite, but mine is separate images animated with bones.. and when i export it cocostudio it doesnt have a plist, its just one big json file...
-
Sonar Systems adminLikes 0
Have you checked the samples out
-
EydamsonLikes 0
yes sir…,
But their examples are deprecated..But I already found the solution..
I just get the child with the animation by name, and get its action then play it..
Thanks anyway.. :)
-
Sonar Systems adminLikes 0
Great :D
Do you wanna post the code as a solution so the community can benefit form your knowledge.
-
EydamsonLikes 0
ooopps!
heres the codevar layer = ccs.load(“json file”); scene.addChild(layer.node); var nodeWithTheAnimations = layer.node.getChildByName("node name"); nodeWithTheAnimations.retain();// for native platform var action = nodeWithTheAnimations.actionManager.getActionByTag(tagNo,nodeWithTheAnimations);// tag number is the tag of the node in the layer action.retain();// for native platform action.setTimeSpeed(0.2);// this can be removed; the default speed is 1, speed is the a floating point between 0-1 (this is the animation speed) action.gotoFrameAndPlay(0,130,true);// 0 and 130 are the frames to be played, the boolean im not sure what it is for im not sure if it will work on you guys… but it works for me, hope it helps
This reply has been verified.
-
Sonar Systems adminLikes 0
Great :D
Login to reply