Merge pull request #69 from CartoDB/68-fix_extra_frame

check loop condition before render
This commit is contained in:
Francisco Dans 2014-12-16 18:34:29 +01:00
commit d25011681a

View File

@ -116,7 +116,6 @@ var cancelAnimationFrame = global.cancelAnimationFrame
delta = Math.min(this.options.maxDelta, delta); delta = Math.min(this.options.maxDelta, delta);
this._t0 = t1; this._t0 = t1;
this._time += delta; this._time += delta;
this.time(this._time);
if(this.step() >= this.options.steps) { if(this.step() >= this.options.steps) {
this._time = 0; this._time = 0;
if(!this.options.loop){ if(!this.options.loop){
@ -124,6 +123,7 @@ var cancelAnimationFrame = global.cancelAnimationFrame
} }
} }
if(this.running) { if(this.running) {
this.time(this._time);
requestAnimationFrame(this._tick); requestAnimationFrame(this._tick);
} }
} }