From db1c57bf78c3cb8d29c3f2f955cc104c28549ab9 Mon Sep 17 00:00:00 2001 From: devonatdomandtom Date: Fri, 20 Apr 2012 15:51:08 -0500 Subject: [PATCH] allow animation to play only once for rotation purposes. --- animatePNG.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/animatePNG.js b/animatePNG.js index 6e53a92..8909c90 100644 --- a/animatePNG.js +++ b/animatePNG.js @@ -39,6 +39,7 @@ y: 0, h: h, w: w, + once: false, imageURL: imageURL, frames: frames }; @@ -71,7 +72,11 @@ } function iterate() { - animation.container.css("background-position", nextX() + "px " + nextY() + "px"); + if (animation.once && nextX()==0) { + animation.stop(); + } else { + animation.container.css("background-position", nextX() + "px " + nextY() + "px"); + } } function start() {