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

13 lines
3.3 KiB
JavaScript
Raw Normal View History

2019-03-21 09:57:27 +01:00
/*!
* VERSION: 0.2.1
* DATE: 2018-02-15
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
* PhysicsPropsPlugin 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";var a=function(a,b,c,d,e,f){this.p=b,this.f="function"==typeof a[b],this.start=this.value=this.f?a[b.indexOf("set")||"function"!=typeof a["get"+b.substr(3)]?b:"get"+b.substr(3)]():parseFloat(a[b]),this.velocity=c||0,this.v=this.velocity/f,d||0==d?(this.acceleration=d,this.a=this.acceleration/(f*f)):this.acceleration=this.a=0,this.friction=1-(e||0)},b=Math.random(),c=_gsScope._gsDefine.globals,d=c.com.greensock.core.Animation._rootFramesTimeline,e=_gsScope._gsDefine.plugin({propName:"physicsProps",version:"0.2.1",API:2,init:function(b,c,e,f){"function"==typeof c&&(c=c(b)),this._target=b,this._tween=e,this._runBackwards=e.vars.runBackwards===!0,this._step=0;for(var g,h,i=e._timeline,j=0;i._timeline;)i=i._timeline;this._stepsPerTimeUnit=i===d?1:30,this._props=[];for(g in c)h=c[g],"function"==typeof h&&(h=h(f,b)),(h.velocity||h.acceleration)&&(this._props[j++]=new a(b,g,h.velocity,h.acceleration,h.friction,this._stepsPerTimeUnit),this._overwriteProps[j]=g,h.friction&&(this._hasFriction=!0));return!0},set:function(a){var b,c,d,e,f,g,h=this._props.length,i=this._tween._time,j=this._target;if(this._runBackwards&&(i=this._tween._duration-i),this._hasFriction){if(i*=this._stepsPerTimeUnit,d=(0|i)-this._step,e=i%1,d>=0)for(;--h>-1;){for(b=this._props[h],f=d;--f>-1;)b.v+=b.a,b.v*=b.friction,b.value+=b.v;c=b.value+b.v*e,b.m&&(c=b.m(c,j)),b.f?j[b.p](c):j[b.p]=c}else for(;--h>-1;){for(b=this._props[h],f=-d;--f>-1;)b.value-=b.v,b.v/=b.friction,b.v-=b.a;c=b.value+b.v*e,b.m&&(c=b.m(c,j)),b.f?j[b.p](c):j[b.p]=c}this._step+=d}else for(g=i*i*.5;--h>-1;)b=this._props[h],c=b.start+(b.velocity*i+b.acceleration*g),b.m&&(c=b.m(c,j)),b.f?j[b.p](c):j[b.p]=c}}),f=e.prototype;f._kill=function(a){for(var b=this._props.length;--b>-1;)this._props[b].p in a&&this._props.splice(b,1);return this._super._kill.call(this,a)},f._mod=function(a){for(var b,c=this._props.length;--c>-1;)b=a[this._props[c].p]||a.physicsProps,"function"==typeof b&&(this._props[c].m=b)},e._autoCSS=!0,e._cssRegister=function(){var a=c.CSSPlugin;if(a){var d=a._internals,f=d._parseToProxy,g=d._setPluginRatio,h=d.CSSPropTween;d._registerComplexSpecialProp("physicsProps",{parser:function(a,c,d,i,j,k){k=new e;var l,m,n={};c.scale&&(c.scaleX=c.scaleY=c.scale,delete c.scale);for(l in c)n[l]=b++;return m=f(a,n,i,j,k),j=new h(a,"physicsProps",0,0,m.pt,2),j.data=m,j.plugin=k,j.setRatio=g,k._onInitTween(m.proxy,c,i._tween),j}})}}}),_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)}("PhysicsPropsPlugin");