pauses animation at end if loop is false

This commit is contained in:
Francisco Dans 2014-12-15 16:05:51 +01:00
parent ba1ae9856c
commit 88ea3bee66

View File

@ -30,7 +30,7 @@ var cancelAnimationFrame = global.cancelAnimationFrame
this.options = torque.extend({
animationDelay: 0,
maxDelta: 0.2,
loop: true
loop: options.loop
}, this.options);
this.rescale();
@ -118,6 +118,9 @@ var cancelAnimationFrame = global.cancelAnimationFrame
this.time(this._time);
if(this.step() >= this.options.steps) {
this._time = 0;
if(!this.options.loop){
this.pause();
}
}
if(this.running) {
requestAnimationFrame(this._tick);