/*! * VERSION: 0.11.2 * DATE: 2019-02-07 * UPDATES AND DOCS AT: http://greensock.com * * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. * ThrowPropsPlugin is a Club GreenSock membership benefit; You must have a valid membership to use * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. * This work is subject to the software agreement that was issued with your membership. * * @author: Jack Doyle, jack@greensock.com */ var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("plugins.ThrowPropsPlugin",["plugins.TweenPlugin","TweenLite","easing.Ease","utils.VelocityTracker"],function(a,b,c,d){var e,f,g,h,i=function(b,c){a.call(this,"throwProps"),this._overwriteProps.length=0},j=999999999999999,k=1e-10,l=_gsScope._gsDefine.globals,m=!1,n={x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1},o=function(a,b,c,d,e){var f,g,h,i,k=b.length,l=0,m=j;if("object"==typeof a){for(;--k>-1;){f=b[k],g=0;for(h in a)i=f[h]-a[h],g+=i*i;m>g&&(l=k,m=g)}if(j>(e||j)&&e-1;)f=b[k],g=f-a,0>g&&(g=-g),m>g&&f>=d&&c>=f&&(l=k,m=g);return b[l]},p=function(a,b,c,d,e,f){if("auto"===a.end)return a;var g,h,i=a.end;if(c=isNaN(c)?j:c,d=isNaN(d)?-j:d,"object"==typeof b){if(g=b.calculated?b:("function"==typeof i?i(b):o(b,i,c,d,f))||b,!b.calculated){for(h in g)b[h]=g[h];b.calculated=!0}g=g[e]}else g="function"==typeof i?i(b):i instanceof Array?o(b,i,c,d,f):Number(i);return g>c?g=c:d>g&&(g=d),{max:g,min:g,unitFactor:a.unitFactor}},q=function(a,b,c){for(var d in b)void 0===a[d]&&d!==c&&(a[d]=b[d]);return a},r=i.calculateChange=function(a,d,e,f){null==f&&(f=.05);var g=d instanceof c?d:d?new c(d):b.defaultEase;return e*f*a/g.getRatio(f)},s=i.calculateDuration=function(a,d,e,f,g){g=g||.05;var h=f instanceof c?f:f?new c(f):b.defaultEase;return Math.abs((d-a)*h.getRatio(g)/e/g)},t=i.calculateTweenDuration=function(a,e,f,g,h,j){if("string"==typeof a&&(a=b.selector(a)),!a)return 0;null==f&&(f=10),null==g&&(g=.2),null==h&&(h=1),a.length&&(a=a[0]||a);var l,n,o,t,u,v,w,x,y,z,A,B,C,D=0,E=9999999999,F=e.throwProps||e,G=e.ease instanceof c?e.ease:e.ease?new c(e.ease):b.defaultEase,H=isNaN(F.checkpoint)?.05:Number(F.checkpoint),I=isNaN(F.resistance)?i.defaultResistance:Number(F.resistance);if(F.linkedProps)for(B=F.linkedProps.split(","),A={},C=0;C0?t/u:t/-u,v="function"==typeof a[l]?a[l.indexOf("set")||"function"!=typeof a["get"+l.substr(3)]?l:"get"+l.substr(3)]():a[l]||0,A[l]=v+r(t,G,o,H));for(l in F)"resistance"!==l&&"checkpoint"!==l&&"preventOvershoot"!==l&&"linkedProps"!==l&&"radius"!==l&&(n=F[l],"object"!=typeof n&&(y=y||d.getByTarget(a),y&&y.isTrackingProp(l)?n="number"==typeof n?{velocity:n}:{velocity:y.getVelocity(l)}:(t=Number(n)||0,o=t*I>0?t/I:t/-I)),"object"==typeof n&&(void 0!==n.velocity&&"number"==typeof n.velocity?t=Number(n.velocity)||0:(y=y||d.getByTarget(a),t=y&&y.isTrackingProp(l)?y.getVelocity(l):0),u=isNaN(n.resistance)?I:Number(n.resistance),o=t*u>0?t/u:t/-u,v="function"==typeof a[l]?a[l.indexOf("set")||"function"!=typeof a["get"+l.substr(3)]?l:"get"+l.substr(3)]():a[l]||0,w=v+r(t,G,o,H),void 0!==n.end&&(n=p(n,A&&l in A?A:w,n.max,n.min,l,F.radius),(j||m)&&(F[l]=q(n,F[l],"end"))),void 0!==n.max&&w>Number(n.max)+k?(z=n.unitFactor||i.defaultUnitFactors[l]||1,x=v>n.max&&n.min!==n.max||t*z>-15&&45>t*z?g+.1*(f-g):s(v,n.max,t,G,H),E>x+h&&(E=x+h)):void 0!==n.min&&w-45&&15>t*z?g+.1*(f-g):s(v,n.min,t,G,H),E>x+h&&(E=x+h)),x>D&&(D=x)),o>D&&(D=o));return D>E&&(D=E),D>f?f:g>D?g:D},u=i.prototype=new a("throwProps");return u.constructor=i,i.version="0.11.2",i.API=2,i._autoCSS=!0,i.defaultResistance=100,i.defaultUnitFactors={time:1e3,totalTime:1e3},i.track=function(a,b,c){return d.track(a,b,c)},i.untrack=function(a,b){d.untrack(a,b)},i.isTracking=function(a,b){return d.isTracking(a,b)},i.getVelocity=function(a,b){var c=d.getByTarget(a);return c?c.getVelocity(b):NaN},i._cssRegister=function(){var a=l.com.greensock.plugins.CSSPlugin;if(a){var b=a._internals,c=b._parseToProxy,g=b._setPluginRatio,h=b.CSSPropTween;b._registerComplexSpecialProp("throwProps",{parser:function(a,b,j,k,l,m){m=new i;var o,p,q,r,s,t={},u={},v={},w={},x={},y={};f={};for(q in b)"resistance"!==q&&"preventOvershoot"!==q&&"linkedProps"!==q&&"radius"!==q&&(p=b[q],"object"==typeof p?(void 0!==p.velocity&&"number"==typeof p.velocity?t[q]=Number(p.velocity)||0:(s=s||d.getByTarget(a),t[q]=s&&s.isTrackingProp(q)?s.getVelocity(q):0),void 0!==p.end&&(w[q]=p.end),void 0!==p.min&&(u[q]=p.min),void 0!==p.max&&(v[q]=p.max),p.preventOvershoot&&(y[q]=!0),void 0!==p.resistance&&(o=!0,x[q]=p.resistance)):"number"==typeof p?t[q]=p:(s=s||d.getByTarget(a),s&&s.isTrackingProp(q)?t[q]=s.getVelocity(q):t[q]=p||0),n[q]&&k._enableTransforms(2===n[q]));r=c(a,t,k,l,m),e=r.proxy,t=r.end;for(q in e)f[q]={velocity:t[q],min:u[q],max:v[q],end:w[q],resistance:x[q],preventOvershoot:y[q]};return null!=b.resistance&&(f.resistance=b.resistance),null!=b.linkedProps&&(f.linkedProps=b.linkedProps),null!=b.radius&&(f.radius=b.radius),b.preventOvershoot&&(f.preventOvershoot=!0),l=new h(a,"throwProps",0,0,r.pt,2),k._overwriteProps.pop(),l.plugin=m,l.setRatio=g,l.data=r,m._onInitTween(e,f,k._tween),l}})}},i.to=function(a,c,d,i,j){c.throwProps||(c={throwProps:c}),0===j&&(c.throwProps.preventOvershoot=!0),m=!0;var k=new b(a,i||1,c);return k.render(0,!0,!0),k.vars.css?(k.duration(t(e,{throwProps:f,ease:c.ease},d,i,j)),k._delay&&!k.vars.immediateRender?k.invalidate():g._onInitTween(e,h,k),m=!1,k):(k.kill(),k=new b(a,t(a,c,d,i,j),c),m=!1,k)},u._onInitTween=function(a,b,c,e){this.target=a,this._props=[],g=this,h=b;var f,i,j,k,l,n,o,s,t,u,v,w,x=c._ease,y=isNaN(b.checkpoint)?.05:Number(b.checkpoint),z=c._duration,A=b.preventOvershoot,B=0;if(b.linkedProps)for(v=b.linkedProps.split(","),u={},w=0;wo&&(A||i.preventOvershoot?n=i.min-j:s=i.min-j-n)),this._overwriteProps[B]=f,this._props[B++]={p:f,s:j,c1:n,c2:s,f:k,r:!1}}return!0},u._kill=function(b){for(var c=this._props.length;--c>-1;)null!=b[this._props[c].p]&&this._props.splice(c,1);return a.prototype._kill.call(this,b)},u._mod=function(a){for(var b,c=this._props,d=c.length;--d>-1;)b=a[c[d].p]||a.throwProps,"function"==typeof b&&(c[d].m=b)},u.setRatio=function(a){for(var b,c,d=this._props.length;--d>-1;)b=this._props[d],c=b.s+b.c1*a+b.c2*a*a,b.m?c=b.m(c,this.target):1===a&&(c=(1e4*c+(0>c?-.5:.5)|0)/1e4),b.f?this.target[b.p](c):this.target[b.p]=c},a.activate([i]),i},!0),_gsScope._gsDefine("utils.VelocityTracker",["TweenLite"],function(a){var b,c,d,e,f=/([A-Z])/g,g={},h=_gsScope.document,i={x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1},j="undefined"!=typeof window?window:h.defaultView||{getComputedStyle:function(){}},k=function(a){return j.getComputedStyle(a)},l=function(a,b,c){var d=(a._gsTransform||g)[b];return d||0===d?d:(a.style[b]?d=a.style[b]:(c=c||k(a,null))?d=c[b]||c.getPropertyValue(b)||c.getPropertyValue(b.replace(f,"-$1").toLowerCase()):a.currentStyle&&(d=a.currentStyle[b]),parseFloat(d)||0)},m=a.ticker,n=function(a,b,c){this.p=a,this.f=b,this.v1=this.v2=0,this.t1=this.t2=m.time,this.css=!1,this.type="",this._prev=null,c&&(this._next=c,c._prev=this)},o=function(){var a,c,f=b,g=m.time;if(g-d>=.03)for(e=d,d=g;f;){for(c=f._firstVP;c;)a=c.css?l(f.target,c.p):c.f?f.target[c.p]():f.target[c.p],(a!==c.v1||g-c.t1>.15)&&(c.v2=c.v1,c.v1=a,c.t2=c.t1,c.t1=g),c=c._next;f=f._next}},p=function(a){this._lookup={},this.target=a,this.elem=a.style&&a.nodeType?!0:!1,c||(m.addEventListener("tick",o,null,!1,-100),d=e=m.time,c=!0),b&&(this._next=b,b._prev=this),b=this},q=p.getByTarget=function(a){for(var c=b;c;){if(c.target===a)return c;c=c._next}},r=p.prototype;return r.addProp=function(b,c){if(!this._lookup[b]){var d=this.target,e="function"==typeof d[b],f=e?this._altProp(b):b,g=this._firstVP;this._firstVP=this._lookup[b]=this._lookup[f]=g=new n(f!==b&&0===b.indexOf("set")?f:b,e,g),g.css=this.elem&&(void 0!==this.target.style[g.p]||i[g.p]),g.css&&i[g.p]&&!d._gsTransform&&a.set(d,{x:"+=0",overwrite:!1}),g.type=c||g.css&&0===b.indexOf("rotation")?"deg":"",g.v1=g.v2=g.css?l(d,g.p):e?d[g.p]():d[g.p]}},r.removeProp=function(a){var b=this._lookup[a];b&&(b._prev?b._prev._next=b._next:b===this._firstVP&&(this._firstVP=b._next),b._next&&(b._next._prev=b._prev),this._lookup[a]=0,b.f&&(this._lookup[this._altProp(a)]=0))},r.isTrackingProp=function(a){return this._lookup[a]instanceof n},r.getVelocity=function(a){var b,c,d,e=this._lookup[a],f=this.target;if(!e)throw"The velocity of "+a+" is not being tracked.";return b=e.css?l(f,e.p):e.f?f[e.p]():f[e.p],c=b-e.v2,("rad"===e.type||"deg"===e.type)&&(d="rad"===e.type?2*Math.PI:360,c%=d,c!==c%(d/2)&&(c=0>c?c+d:c-d)),c/(m.time-e.t2)},r._altProp=function(a){var b=a.substr(0,3),c=("get"===b?"set":"set"===b?"get":b)+a.substr(3);return"function"==typeof this.target[c]?c:a},p.getByTarget=function(c){var d=b;for("string"==typeof c&&(c=a.selector(c)),c.length&&c!==window&&c[0]&&c[0].style&&!c.nodeType&&(c=c[0]);d;){if(d.target===c)return d;d=d._next}},p.track=function(a,b,c){var d=q(a),e=b.split(","),f=e.length;for(c=(c||"").split(","),d||(d=new p(a));--f>-1;)d.addProp(e[f],c[f]||c[0]);return d},p.untrack=function(a,c){var d=q(a),e=(c||"").split(","),f=e.length;if(d){for(;--f>-1;)d.removeProp(e[f]);d._firstVP&&c||(d._prev?d._prev._next=d._next:d===b&&(b=d._next),d._next&&(d._next._prev=d._prev))}},p.isTracking=function(a,b){var c=q(a);return c?!b&&c._firstVP?!0:c.isTrackingProp(b):!1},p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(a){"use strict";var b=function(){return(_gsScope.GreenSockGlobals||_gsScope)[a]};"undefined"!=typeof module&&module.exports?(require("../TweenLite.min.js"),module.exports=b()):"function"==typeof define&&define.amd&&define(["TweenLite"],b)}("ThrowPropsPlugin");