!function(n){if("object"==typeof exports)module.exports=n();else if("function"==typeof define&&define.amd)define(n);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self);t.Bounce=n()}}(function(){return function n(t,i,r){function u(f,o){var h,s;if(!i[f]){if(!t[f]){if(h="function"==typeof require&&require,!o&&h)return h(f,!0);if(e)return e(f,!0);throw new Error("Cannot find module '"+f+"'");}s=i[f]={exports:{}};t[f][0].call(s.exports,function(n){var i=t[f][1][n];return u(i?i:n)},s,s.exports,n,t,i,r)}return i[f].exports}for(var e="function"==typeof require&&require,f=0;f<r.length;f++)u(r[f]);return u}({1:[function(n,t){var i,r,u;u=n("../math/matrix4d");r={bounce:n("../easing/bounce"),sway:n("../easing/sway"),hardbounce:n("../easing/hardbounce"),hardsway:n("../easing/hardsway")};i=function(){function n(n){n||(n={});null!=n.easing&&(this.easing=n.easing);null!=n.duration&&(this.duration=n.duration);null!=n.delay&&(this.delay=n.delay);null!=n.from&&(this.from=n.from);null!=n.to&&(this.to=n.to);this.easingObject=new r[this.easing](n)}return n.prototype.easing="bounce",n.prototype.duration=1e3,n.prototype.delay=0,n.prototype.from=null,n.prototype.to=null,n.prototype.calculateEase=function(n){return this.easingObject.calculate(n)},n.prototype.getMatrix=function(){return(new u).identity()},n.prototype.getEasedMatrix=function(){return this.getMatrix()},n.prototype.serialize=function(){var n,t,r,i;t={type:this.constructor.name.toLowerCase(),easing:this.easing,duration:this.duration,delay:this.delay,from:this.from,to:this.to};i=this.easingObject.serialize();for(n in i)r=i[n],t[n]=r;return t},n}();t.exports=i},{"../easing/bounce":6,"../easing/hardbounce":7,"../easing/hardsway":8,"../easing/sway":10,"../math/matrix4d":12}],2:[function(n,t){var i,r,u,f,e={}.hasOwnProperty,o=function(n,t){function r(){this.constructor=n}for(var i in t)e.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};r=n("../math/matrix4d");f=n("../math/vector2d");i=n("./index");u=function(n){function t(){t.__super__.constructor.apply(this,arguments);this.diff=this.to-this.from}return o(t,n),t.prototype.from=0,t.prototype.to=90,t.prototype.getMatrix=function(n){var t,i,u;return i=n/180*Math.PI,t=Math.cos(i),u=Math.sin(i),new r([t,-u,0,0,u,t,0,0,0,0,1,0,0,0,0,1])},t.prototype.getEasedMatrix=function(n){var t,i;return i=this.calculateEase(n),t=this.from+this.diff*i,this.getMatrix(t)},t}(i);t.exports=u},{"../math/matrix4d":12,"../math/vector2d":13,"./index":1}],3:[function(n,t){var r,u,f,i,e={}.hasOwnProperty,o=function(n,t){function r(){this.constructor=n}for(var i in t)e.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};u=n("../math/matrix4d");i=n("../math/vector2d");r=n("./index");f=function(n){function t(){t.__super__.constructor.apply(this,arguments);this.fromVector=new i(this.from.x,this.from.y);this.toVector=new i(this.to.x,this.to.y);this.diff=this.toVector.clone().subtract(this.fromVector)}return o(t,n),t.prototype.from={x:.5,y:.5},t.prototype.to={x:1,y:1},t.prototype.getMatrix=function(n,t){var i;return i=1,new u([n,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1])},t.prototype.getEasedMatrix=function(n){var i,t;return i=this.calculateEase(n),t=this.fromVector.clone().add(this.diff.clone().multiply(i)),this.getMatrix(t.x,t.y)},t}(r);t.exports=f},{"../math/matrix4d":12,"../math/vector2d":13,"./index":1}],4:[function(n,t){var r,u,f,i,e={}.hasOwnProperty,o=function(n,t){function r(){this.constructor=n}for(var i in t)e.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};u=n("../math/matrix4d");i=n("../math/vector2d");r=n("./index");f=function(n){function t(){t.__super__.constructor.apply(this,arguments);this.fromVector=new i(this.from.x,this.from.y);this.toVector=new i(this.to.x,this.to.y);this.diff=this.toVector.clone().subtract(this.fromVector)}return o(t,n),t.prototype.from={x:0,y:0},t.prototype.to={x:20,y:0},t.prototype.getMatrix=function(n,t){var i,r,f,e;return i=n/180*Math.PI,r=t/180*Math.PI,f=Math.tan(i),e=Math.tan(r),new u([1,f,0,0,e,1,0,0,0,0,1,0,0,0,0,1])},t.prototype.getEasedMatrix=function(n){var i,t;return i=this.calculateEase(n),t=this.fromVector.clone().add(this.diff.clone().multiply(i)),this.getMatrix(t.x,t.y)},t}(r);t.exports=f},{"../math/matrix4d":12,"../math/vector2d":13,"./index":1}],5:[function(n,t){var r,u,f,i,e={}.hasOwnProperty,o=function(n,t){function r(){this.constructor=n}for(var i in t)e.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};u=n("../math/matrix4d");i=n("../math/vector2d");r=n("./index");f=function(n){function t(){t.__super__.constructor.apply(this,arguments);this.fromVector=new i(this.from.x,this.from.y);this.toVector=new i(this.to.x,this.to.y);this.diff=this.toVector.clone().subtract(this.fromVector)}return o(t,n),t.prototype.from={x:0,y:0},t.prototype.to={x:0,y:0},t.prototype.getMatrix=function(n,t){var i;return i=0,new u([1,0,0,n,0,1,0,t,0,0,1,i,0,0,0,1])},t.prototype.getEasedMatrix=function(n){var i,t;return i=this.calculateEase(n),t=this.fromVector.clone().add(this.diff.clone().multiply(i)),this.getMatrix(t.x,t.y)},t}(r);t.exports=f},{"../math/matrix4d":12,"../math/vector2d":13,"./index":1}],6:[function(n,t){var i,r,u={}.hasOwnProperty,f=function(n,t){function r(){this.constructor=n}for(var i in t)u.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};r=n("./index");i=function(n){function t(n){var i;null==n&&(n={});t.__super__.constructor.apply(this,arguments);null!=n.stiffness&&(this.stiffness=n.stiffness);null!=n.bounces&&(this.bounces=n.bounces);this.alpha=this.stiffness/100;i=.005/Math.pow(10,this.stiffness);this.limit=Math.floor(Math.log(i)/-this.alpha);this.omega=this.bounces*Math.PI/this.limit}return f(t,n),t.prototype.bounces=4,t.prototype.stiffness=3,t.prototype.calculate=function(n){var t;return n>=1?1:(t=n*this.limit,1-this.exponent(t)*this.oscillation(t))},t.prototype.exponent=function(n){return Math.pow(Math.E,-this.alpha*n)},t.prototype.oscillation=function(n){return Math.cos(this.omega*n)},t.prototype.serialize=function(){return{stiffness:this.stiffness,bounces:this.bounces}},t}(r);t.exports=i},{"./index":9}],7:[function(n,t){var i,r,u={}.hasOwnProperty,f=function(n,t){function r(){this.constructor=n}for(var i in t)u.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};i=n("./bounce");r=function(n){function t(){return t.__super__.constructor.apply(this,arguments)}return f(t,n),t.prototype.oscillation=function(n){return Math.abs(Math.cos(this.omega*n))},t}(i);t.exports=r},{"./bounce":6}],8:[function(n,t){var i,r,u={}.hasOwnProperty,f=function(n,t){function r(){this.constructor=n}for(var i in t)u.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};r=n("./sway");i=function(n){function t(){return t.__super__.constructor.apply(this,arguments)}return f(t,n),t.prototype.oscillation=function(n){return Math.abs(Math.sin(this.omega*n))},t}(r);t.exports=i},{"./sway":10}],9:[function(n,t){var i;i=function(){function n(){}return n.prototype.calculate=function(n){return n},n.prototype.serialize=function(){return{}},n}();t.exports=i},{}],10:[function(n,t){var i,r,u={}.hasOwnProperty,f=function(n,t){function r(){this.constructor=n}for(var i in t)u.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n};i=n("./bounce");r=function(n){function t(){return t.__super__.constructor.apply(this,arguments)}return f(t,n),t.prototype.calculate=function(n){var t;return n>=1?0:(t=n*this.limit,this.exponent(t)*this.oscillation(t))},t.prototype.oscillation=function(n){return Math.sin(this.omega*n)},t}(i);t.exports=r},{"./bounce":6}],11:[function(n,t){var r,i,u;u=n("./math/matrix4d");i={scale:n("./components/scale"),rotate:n("./components/rotate"),translate:n("./components/translate"),skew:n("./components/skew")};r=function(){function n(){this.components=[]}return n.FPS=30,n.counter=1,n.prototype.components=null,n.prototype.duration=0,n.prototype.scale=function(n){return this.addComponent(new i.scale(n))},n.prototype.rotate=function(n){return this.addComponent(new i.rotate(n))},n.prototype.translate=function(n){return this.addComponent(new i.translate(n))},n.prototype.skew=function(n){return this.addComponent(new i.skew(n))},n.prototype.addComponent=function(n){return this.components.push(n),this.updateDuration(),this},n.prototype.serialize=function(){var r,t,n,u,i;for(t=[],i=this.components,n=0,u=i.length;u>n;n++)r=i[n],t.push(r.serialize());return t},n.prototype.deserialize=function(n){for(var r,t=0,u=n.length;u>t;t++)r=n[t],this.addComponent(new i[r.type](r));return this},n.prototype.updateDuration=function(){return this.duration=this.components.map(function(n){return n.duration+n.delay}).reduce(function(n,t){return Math.max(n,t)})},n.prototype.define=function(t){return this.name=t||n.generateName(),this.styleElement=document.createElement("style"),this.styleElement.innerHTML=this.getKeyframeCSS({name:this.name,prefix:!0}),document.body.appendChild(this.styleElement),this},n.prototype.applyTo=function(n,t){var f,i,o,s,h,r,u,c,l,e;for(null==t&&(t={}),this.define(),n.length||(n=[n]),h=this.getPrefixes(),i=null,window.jQuery&&window.jQuery.Deferred&&(i=new window.jQuery.Deferred),r=0,c=n.length;c>r;r++)for(o=n[r],e=h.animation,u=0,l=e.length;l>u;u++)s=e[u],f=[this.name,""+this.duration+"ms","linear","both"],t.loop&&f.push("infinite"),o.style[""+s+"animation"]=f.join(" ");return t.loop||setTimeout(function(n){return function(){return t.remove&&n.remove(),"function"==typeof t.onComplete&&t.onComplete(),i?i.resolve():void 0}}(this),this.duration),i},n.prototype.remove=function(){var n;if(null!=(n=this.styleElement))return n.remove()},n.prototype.getPrefixes=function(n){var i,t;return i={transform:[""],animation:[""]},t=document.createElement("dummy").style,(n||!("transform"in t)&&"webkitTransform"in t)&&(i.transform=["-webkit-",""]),(n||!("animation"in t)&&"webkitAnimation"in t)&&(i.animation=["-webkit-",""]),i},n.prototype.getKeyframeCSS=function(t){var o,s,h,y,p,i,r,w,c,u,f,e,b,k,d,l,a,v;for(null==t&&(t={}),this.name=t.name||n.generateName(),r={transform:[""],animation:[""]},(t.prefix||t.forcePrefix)&&(r=this.getPrefixes(t.forcePrefix)),h=[],y=this.getKeyframes(),l=this.keys,u=0,b=l.length;b>u;u++){for(s=l[u],p=y[s],w="matrix3d"+p,c=[],a=r.transform,f=0,k=a.length;k>f;f++)i=a[f],c.push(""+i+"transform: "+w+";");h.push(""+Math.round(1e8*s)/1e6+"% { "+c.join(" ")+" }")}for(o=[],v=r.animation,e=0,d=v.length;d>e;e++)i=v[e],o.push("@"+i+"keyframes "+this.name+" { \n  "+h.join("\n  ")+" \n}");return o.join("\n\n")},n.prototype.getKeyframes=function(){var i,v,t,s,f,h,c,y,r,e,o,p,w,l,a;for(t=Math.round(this.duration/1e3*n.FPS),this.keys=[],s=r=0;t>=0?t>=r:r>=t;s=t>=0?++r:--r)this.keys.push(s/t);for(h={},l=this.keys,e=0,p=l.length;p>e;e++){for(f=l[e],c=(new u).identity(),a=this.components,o=0,w=a.length;w>o;o++)i=a[o],v=f*this.duration,i.delay-v>1e-8||(y=(f-i.delay/this.duration)/(i.duration/this.duration),c.multiply(i.getEasedMatrix(y)));h[f]=c.transpose().toFixed(5)}return h},n.generateName=function(){return"animation-"+n.counter++},n.isSupported=function(){var f,n,r,u,e,t,i,o,s;for(e=document.createElement("dummy").style,u=[["transform","webkitTransform"],["animation","webkitAnimation"]],t=0,o=u.length;o>t;t++){for(r=u[t],n=!1,i=0,s=r.length;s>i;i++)f=r[i],n||(n=f in e);if(!n)return!1}return!0},n}();t.exports=r},{"./components/rotate":2,"./components/scale":3,"./components/skew":4,"./components/translate":5,"./math/matrix4d":12}],12:[function(n,t){var i;i=function(){function n(n){this._array=(null!=n?n.slice(0):void 0)||[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}return n.prototype._array=null,n.prototype.equals=function(n){return this.toString()===n.toString()},n.prototype.identity=function(){return this.setArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this},n.prototype.multiply=function(t){for(var r,u,h,e,o,s,f=new n,i=e=0;4>e;i=++e)for(r=o=0;4>o;r=++o)for(u=s=0;4>s;u=++s)h=f.get(i,r)+this.get(i,u)*t.get(u,r),f.set(i,r,h);return this.copy(f)},n.prototype.transpose=function(){var n;return n=this.getArray(),this.setArray([n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15]]),this},n.prototype.get=function(n,t){return this.getArray()[4*n+t]},n.prototype.set=function(n,t,i){return this._array[4*n+t]=i},n.prototype.copy=function(n){return this._array=n.getArray(),this},n.prototype.clone=function(){return new n(this.getArray())},n.prototype.getArray=function(){return this._array.slice(0)},n.prototype.setArray=function(n){return this._array=n,this},n.prototype.toString=function(){return"("+this.getArray().join(", ")+")"},n.prototype.toFixed=function(n){var t;return this._array=function(){var i,f,r,u;for(r=this._array,u=[],i=0,f=r.length;f>i;i++)t=r[i],u.push(parseFloat(t.toFixed(n)));return u}.call(this),this},n}();t.exports=i},{}],13:[function(n,t){var i;i=function(){function n(n,t){this.x=null!=n?n:0;this.y=null!=t?t:0}return n.prototype.x=0,n.prototype.y=0,n.prototype.add=function(t){return n.isVector2D(t)?(this.x+=t.x,this.y+=t.y,this):this._addScalar(t)},n.prototype._addScalar=function(n){return this.x+=n,this.y+=n,this},n.prototype.subtract=function(t){return n.isVector2D(t)?(this.x-=t.x,this.y-=t.y,this):this._subtractScalar(t)},n.prototype._subtractScalar=function(n){return this._addScalar(-n)},n.prototype.multiply=function(t){return n.isVector2D(t)?(this.x*=t.x,this.y*=t.y,this):this._multiplyScalar(t)},n.prototype._multiplyScalar=function(n){return this.x*=n,this.y*=n,this},n.prototype.divide=function(t){return n.isVector2D(t)?(this.x/=t.x,this.y/=t.y,this):this._divideScalar(t)},n.prototype._divideScalar=function(n){return this._multiplyScalar(1/n)},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copy=function(n){return this.x=n.x,this.y=n.y,this},n.prototype.equals=function(n){return n.x===this.x&&n.y===this.y},n.prototype.toString=function(){return"("+this.x+", "+this.y+")"},n.prototype.toFixed=function(n){return this.x=parseFloat(this.x.toFixed(n)),this.y=parseFloat(this.y.toFixed(n)),this},n.prototype.toArray=function(){return[this.x,this.y]},n.isVector2D=function(t){return t instanceof n},n}();t.exports=i},{}]},{},[11])(11)})