cocos2d / cocos2d-js

cocos2d-x for JS
http://www.cocos2d-x.org
MIT License
1.86k stars 489 forks source link

Is this an action speed bug? #1816

Open wuxiaomo6174 opened 8 years ago

wuxiaomo6174 commented 8 years ago

I have an animation then want to dynamic control its speed with action speed. But it is very strange that whatever i add or plus its speed, the animation always speed up.

here is the code:

var animationFrames = [];
for(var i=1;i!=8;i++){
    var path = typeName + i +'.png';
    var frame = cc.spriteFrameCache.getSpriteFrame(path);
    animationFrames.push(frame);
}
var animation = new cc.Animation(animationFrames,intervalTime);
var runningAction = new cc.animate(animation).repeatForever();
runningAction.retain();

here is the speedup function:

adjustRunningSpeed:function(x){
     var speedx =  this.runningAction.getSpeed();
     var finalSpeed = speedx + x;
     this.runningAction.setSpeed(finalSpeed);

},

wuxiaomo6174 commented 8 years ago

@pandamicro Could you help have a look? Maybe it is a bug