diff --git a/Gruntfile.js b/Gruntfile.js index 6d5153e..2057c7e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -82,7 +82,7 @@ module.exports = function(grunt) { bumpup: ['component.json', '<%= pkg.name %>.jquery.json'], // Commit changes and tag the latest commit with a version from JSON file. - tagrelease: ['component.json'] + tagrelease: 'component.json' }); // These plugins provide necessary tasks. diff --git a/component.json b/component.json index 10e25bf..ac9c499 100644 --- a/component.json +++ b/component.json @@ -2,8 +2,8 @@ "name": "motio", "title": "Motio", "description": "Sprite based animations and panning.", - "version": "2.0.0", - "date": "2013-04-05 17:09:39 +00:00", + "version": "2.0.1", + "date": "2013-04-05 19:14:14 +00:00", "homepage": "https://github.com/Darsain/motio", "main": "./dist/motio.js", "bugs": "https://github.com/Darsain/motio/issues", diff --git a/dist/jquery.motio.js b/dist/jquery.motio.js index 3f04134..95c8296 100644 --- a/dist/jquery.motio.js +++ b/dist/jquery.motio.js @@ -135,8 +135,7 @@ * @return {Object} Motio instance. */ self.toStart = function (immediate, callback) { - self.to(0, immediate, callback); - return self; + return self.to(0, immediate, callback); }; /** @@ -148,8 +147,7 @@ * @return {Object} Motio instance. */ self.toEnd = function (immediate, callback) { - self.to(frames.length - 1, immediate, callback); - return self; + return self.to(frames.length - 1, immediate, callback); }; /** @@ -163,7 +161,7 @@ */ self.to = function (frame, immediate, callback) { if (isPan || !isNumber(frame) || frame < 0 || frame >= frames.length) { - return; + return self; } // Handle optional argument @@ -183,7 +181,7 @@ callback.call(self); } self.pause(); - return; + return self; } } @@ -195,6 +193,8 @@ // Resume rendering if paused resume(); + + return self; }; /** @@ -521,9 +521,6 @@ speedY: 0, // Vertical panning speed in pixels per second. bgWidth: 0, // Width of the background image (optional). bgHeight: 0 // Height of the background image (optional). - // it is needed so the script will know when to reset the background position to 0, and thus not overflow the JavaScript 2^53 integer limit - // when 0 (=unknown), the position will iterate into ridiculous numbers, which will in a few million years result into a buggy animation ... - // you basically set this if you have OCD }; })(window); /*global Motio */ diff --git a/dist/jquery.motio.min.js b/dist/jquery.motio.min.js index 4c6c828..0352891 100644 --- a/dist/jquery.motio.min.js +++ b/dist/jquery.motio.min.js @@ -1,8 +1,8 @@ /*! Motio 2.0.0 - 5th Apr 2013 | https://github.com/Darsain/motio */ (function(l){function j(b,t){function G(c){d.reversed=c;v||(a.isPaused=0,A("play"),D())}function x(){y=0;E=B?Math.round(h.x)+"px "+Math.round(h.y)+"px":q[m];E!==H&&(b.style.backgroundPosition=H=E);A("frame");d.finite&&d.to===m&&(a.pause(),"function"===r(d.callback)&&d.callback.call(a))}function D(){d.finite&&d.to===m||(B?(h.x+=f.speedX/f.fps,h.y+=f.speedY/f.fps,f.bgWidth&&Math.abs(h.x)>f.bgWidth&&(h.x%=f.bgWidth),f.bgHeight&&Math.abs(h.y)>f.bgHeight&&(h.y%=f.bgHeight)):(d.finite?m=d.immediate?d.to: m+(m>d.to?-1:1):d.reversed?0>=--m&&(m=q.length-1):++m>=q.length&&(m=0),a.frame=m),d.immediate||(v=60<=f.fps?w(D):setTimeout(D,1E3/f.fps)),y||(y=w(x)))}function I(a,g){s=0;for(C=n[a].length;sc||c>=q.length)){"function"===r(g)&&(e=g,g=!1);if(c===m)if(0===c)m=q.length;else if(c===q.length-1)m=-1;else{"function"===r(e)&&e.call(a);a.pause();return}d.finite=1;d.to=c;d.immediate=g;d.callback=e;G()}};a.set=function(c,g){f[c]=g;return a};a.on=function(c,g){if("object"===r(c))for(var e in c){if(c.hasOwnProperty(e))a.on(e,c[e])}else if("function"===r(g)){e=c.split(" ");for(var b=0,d=e.length;bc||c>=q.length)return a;"function"===r(g)&&(e=g,g=!1);if(c===m)if(0===c)m=q.length;else if(c===q.length-1)m=-1;else return"function"===r(e)&&e.call(a),a.pause(),a;d.finite=1;d.to=c;d.immediate=g;d.callback=e;G();return a};a.set=function(c,g){f[c]=g;return a};a.on=function(c,g){if("object"===r(c))for(var e in c){if(c.hasOwnProperty(e))a.on(e,c[e])}else if("function"===r(g)){e=c.split(" ");for(var b=0,d=e.length;b= frames.length) { - return; + return self; } // Handle optional argument @@ -183,7 +181,7 @@ callback.call(self); } self.pause(); - return; + return self; } } @@ -195,6 +193,8 @@ // Resume rendering if paused resume(); + + return self; }; /** @@ -521,8 +521,5 @@ speedY: 0, // Vertical panning speed in pixels per second. bgWidth: 0, // Width of the background image (optional). bgHeight: 0 // Height of the background image (optional). - // it is needed so the script will know when to reset the background position to 0, and thus not overflow the JavaScript 2^53 integer limit - // when 0 (=unknown), the position will iterate into ridiculous numbers, which will in a few million years result into a buggy animation ... - // you basically set this if you have OCD }; })(window); \ No newline at end of file diff --git a/dist/motio.min.js b/dist/motio.min.js index 1124859..470dc79 100644 --- a/dist/motio.min.js +++ b/dist/motio.min.js @@ -1,8 +1,8 @@ /*! Motio 2.0.0 - 5th Apr 2013 | https://github.com/Darsain/motio */ (function(n){function z(p,m){function H(c){b.reversed=c;t||(a.isPaused=0,A("play"),E())}function v(){w=0;F=B?Math.round(d.x)+"px "+Math.round(d.y)+"px":q[h];F!==I&&(p.style.backgroundPosition=I=F);A("frame");b.finite&&b.to===h&&(a.pause(),"function"===j(b.callback)&&b.callback.call(a))}function E(){b.finite&&b.to===h||(B?(d.x+=g.speedX/g.fps,d.y+=g.speedY/g.fps,g.bgWidth&&Math.abs(d.x)>g.bgWidth&&(d.x%=g.bgWidth),g.bgHeight&&Math.abs(d.y)>g.bgHeight&&(d.y%=g.bgHeight)):(b.finite?h=b.immediate?b.to: h+(h>b.to?-1:1):b.reversed?0>=--h&&(h=q.length-1):++h>=q.length&&(h=0),a.frame=h),b.immediate||(t=60<=g.fps?C(E):setTimeout(E,1E3/g.fps)),w||(w=C(v)))}function y(a,f){r=0;for(D=k[a].length;rc||c>=q.length)){"function"===j(f)&&(e=f,f=!1);if(c===h)if(0===c)h=q.length;else if(c===q.length-1)h=-1;else{"function"===j(e)&&e.call(a);a.pause();return}b.finite=1;b.to=c;b.immediate=f;b.callback=e;H()}};a.set=function(c,f){g[c]=f;return a};a.on=function(c,f){if("object"===j(c))for(var e in c){if(c.hasOwnProperty(e))a.on(e,c[e])}else if("function"===j(f)){e=c.split(" ");for(var b=0,d=e.length;bc||c>=q.length)return a;"function"===j(f)&&(e=f,f=!1);if(c===h)if(0===c)h=q.length;else if(c===q.length-1)h=-1;else return"function"===j(e)&&e.call(a),a.pause(),a;b.finite=1;b.to=c;b.immediate=f;b.callback=e;H();return a};a.set=function(c,f){g[c]=f;return a};a.on=function(c,f){if("object"===j(c))for(var e in c){if(c.hasOwnProperty(e))a.on(e,c[e])}else if("function"===j(f)){e=c.split(" ");for(var b=0,d=e.length;b