iwmlib/lib/3rdparty/greensock/src/minified/plugins/ThrowPropsPlugin.min.js

13 lines
11 KiB
JavaScript
Raw Normal View History

2019-03-21 09:57:27 +01:00
/*!
* 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<Math.sqrt(m))return a}else for(;--k>-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;C<B.length;C++)l=B[C],n=F[l],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,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<Number(n.min)-k&&(z=n.unitFactor||i.defaultUnitFactors[l]||1,x=v<n.min&&n.min!==n.max||t*z>-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._registerComplexSpecia