创建个精灵在里面写导入动画,但是不好用。
注释那地方是创建的动画就可以用。
求教JS里导入cocostudio2.1动画怎么写
var HerosSprite = cc.Sprite.extend({
_hero : null,
_kenActTag : null,
ctor : function(aTexture){
this._super(aTexture);
ccs.armatureDataManager.addArmatureFileInfo(res.KenAnimation01_json);
this._hero = ccs.ActionTimeline(res.KenAnimation01_json);
this.runAction(this._hero);
this._kenActTag = this._hero.getTag();
this._hero = this.getActionByTag(this._kenActTag)
this._hero.gotoFrameAndPlay(0,true);
// var frame0 = cc.spriteFrameCache.getSpriteFrame(“chunli40.png”);
// var frame1 = cc.spriteFrameCache.getSpriteFrame(“chunli42.png”);
//
// var animFrames = ];
// animFrames.push(frame0);
// animFrames.push(frame1);
//
// // ship animate
// var animation = new cc.Animation(animFrames, 0.1);
// var animate = cc.animate(animation);
// var action = animate.repeatForever();
// this.runAction(action);
}
});