Please give me small example of cocos2d-html5 animations from scratch.

Please give me small example of cocos2d-html5 animations from scratch.
0.0 0



I am having trouble doing animations from .plist files.

I have seen this example but can’t understand what is dance_1 and anything :

var animCache = cc.AnimationCache.getInstance();

var animation2 = animCache.getAnimation(“dance_1”);

var action2 = cc.Animate.create(animation2);
sprite.runAction(cc.Sequence.create(action2, action2.reverse()));

Please give me a general and easy example .


Take a look at my code in this posting,


@Roger Clark,

Hi I have seen this example. But there is a function called cache.addSpriteFramesWithJson() in CCSpriteFrameCache.js do you know how to make use of it?

I think this is more javascript friendly than plist.


@srikanth chitturi

My sprite data was cocos2d plist format not JSON format


@Roger Clark

Yeah I know that , my problem is I am in a windows system and I have no zwoptex tool but I have been using the zwoptex flash version and I think it is
not an effective way.
Even though texture packer is present it is not available as free.

So I am looking for an alternative way like json animation or another tool with .plist extension which is free.


Buy Texture Packer, it’s worth every cent.


I use texture packer as well

Flash Cs6 can also export sprite sheets as cocos2d plist, and there is a 30 day demo, but after that its $$$$$$$

If you have a JSON sprite sheet tool, just look at the JSON data it exports and modify my code to match your incoming data -