From 88ea3bee66080c08febed4d94b3d745c1c8daa39 Mon Sep 17 00:00:00 2001 From: Francisco Dans Date: Mon, 15 Dec 2014 16:05:51 +0100 Subject: [PATCH] pauses animation at end if loop is false --- lib/torque/animator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/torque/animator.js b/lib/torque/animator.js index a7dc61a..dec73ff 100644 --- a/lib/torque/animator.js +++ b/lib/torque/animator.js @@ -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);