Merge pull request #13 from tacitknowledge/master

Add CommonJS and AMD support.
This commit is contained in:
George
2016-05-15 10:19:25 +04:00
2 changed files with 26 additions and 3 deletions
+14 -1
View File
@@ -2,4 +2,17 @@
What is it? A jQuery plugin from GSGD to give advanced easing options. More info [here](http://gsgd.co.uk/sandbox/jquery/easing)
For CDN please use CloudFlare [`http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js`](http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js) to help my host. Thank you.
For CDN please use CloudFlare [`http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js`](http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js) to help my host. Thank you.
# AMD or CommonJS usage
```js
// CommonJS
var jQuery = require('jquery');
require('jquery.easing')(jQuery);
// AMD
define(['jquery', 'jquery.easing'], function (jQuery, easing) {
easing(jQuery)
})
```
+12 -2
View File
@@ -7,7 +7,17 @@
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
(function($){$.easing['jswing'] = $.easing['swing'];
(function (factory) {
if (typeof define === "function" && define.amd) {
define(function () {
return factory;
});
} else if (typeof module === "object" && typeof module.exports === "object") {
exports = factory;
} else {
factory(jQuery);
}
})(function($){$.easing['jswing'] = $.easing['swing'];
$.extend( $.easing,
{
@@ -140,4 +150,4 @@ $.extend( $.easing,
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});})(jQuery);
});});