LocalCDN-Firefox-Chrome-Brave/resources/gsap/2.1.3/RaphaelPlugin.min.jsm

12 lines
5.6 KiB
JavaScript

/*!
* VERSION: 0.2.2
* DATE: 2018-02-15
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
* This work is subject to the terms at http://greensock.com/standard-license or for
* Club GreenSock members, 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=/[^\d\-\.]/g,b=Math.PI/180,c=/(\d|\.)+/g,d={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},e=function(a){return"number"==typeof a?[a>>16,a>>8&255,255&a]:""===a||null==a||"none"===a||"string"!=typeof a?d.transparent:d[a]?d[a]:"#"===a.charAt(0)?(4===a.length&&(a="#"+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)+a.charAt(3)+a.charAt(3)),a=parseInt(a.substr(1),16),[a>>16,a>>8&255,255&a]):a.match(c)||d.transparent},f={scaleX:1,scaleY:1,tx:1,ty:1,rotation:1,shortRotation:1,skewX:1,skewY:1,scale:1},g=function(a,b){var c=a.matrix,d=1e-6,e=c.a,f=c.b,g=c.c,h=c.d,i=b?a._gsTransform||{skewY:0}:{skewY:0},j=i.scaleX<0;return i.tx=c.e-(i.ox||0),i.ty=c.f-(i.oy||0),i.scaleX=Math.sqrt(e*e+f*f),i.scaleY=Math.sqrt(h*h+g*g),i.rotation=e||f?Math.atan2(f,e):i.rotation||0,i.skewX=g||h?Math.atan2(g,h)+i.rotation:i.skewX||0,Math.abs(i.skewX)>Math.PI/2&&(j?(i.scaleX*=-1,i.skewX+=i.rotation<=0?Math.PI:-Math.PI,i.rotation+=i.rotation<=0?Math.PI:-Math.PI):(i.scaleY*=-1,i.skewX+=i.skewX<=0?Math.PI:-Math.PI)),i.rotation<d&&i.rotation>-d&&(e||f)&&(i.rotation=0),i.skewX<d&&i.skewX>-d&&(f||g)&&(i.skewX=0),b&&(a._gsTransform=i),i},h=function(a,b){return null==a?b:"string"==typeof a&&1===a.indexOf("=")?parseInt(a.charAt(0)+"1",10)*Number(a.substr(2))+b:Number(a)},i=function(c,d){var e=-1===c.indexOf("rad")?b:1,f=1===c.indexOf("=");return c=Number(c.replace(a,""))*e,f?c+d:c},j=_gsScope._gsDefine.plugin({propName:"raphael",version:"0.2.2",API:2,init:function(b,c,d){if(!b.attr)return!1;this._target=b,this._tween=d,this._props=b._gsProps=b._gsProps||{};var g,h,i,j,k,l,m;for(g in c)i=c[g],"transform"!==g?f[g]||"pivot"===g?this._parseTransform(b,c):(h=b.attr(g),this._firstPT=j={_next:this._firstPT,t:this._props,p:g,b:h,f:!1,n:"raphael_"+g,r:!1,type:0},"fill"===g||"stroke"===g?(k=e(h),l=e(i),j.e=i,j.s=Number(k[0]),j.c=Number(l[0])-j.s,j.gs=Number(k[1]),j.gc=Number(l[1])-j.gs,j.bs=Number(k[2]),j.bc=Number(l[2])-j.bs,k.length>3||l.length>3?(j.as=k.length<4?1:Number(k[3]),j.ac=(l.length<4?1:Number(l[3]))-j.as,j.type=2):j.type=1):(h="string"==typeof h?parseFloat(h.replace(a,"")):Number(h),"string"==typeof i?(m="="===i.charAt(1),i=parseFloat(i.replace(a,""))):m=!1,j.e=i||0===i?m?i+h:i:c[g],!h&&0!==h||!i&&0!==i||!(j.c=m?i:i-h)?(j.type=-1,j.i=c[g],j.s=j.c=0):j.s=h),this._overwriteProps.push("raphael_"+g),j._next&&(j._next._prev=j)):this._parseTransform(b,i);return!0},set:function(a){for(var b,c=this._firstPT;c;)b=c.c*a+c.s,c.r&&(b=Math.round(b)),c.type?1===c.type?c.t[c.p]="rgb("+(b>>0)+", "+(c.gs+a*c.gc>>0)+", "+(c.bs+a*c.bc>>0)+")":2===c.type?c.t[c.p]="rgba("+(b>>0)+", "+(c.gs+a*c.gc>>0)+", "+(c.bs+a*c.bc>>0)+", "+(c.as+a*c.ac)+")":-1===c.type&&(c.t[c.p]=c.i):c.t[c.p]=b,c=c._next;if(this._target.attr(this._props),this._transform){c=this._transform;var d=c.rotation,e=d-c.skewX,f=Math.cos(d)*c.scaleX,g=Math.sin(d)*c.scaleX,h=Math.sin(e)*-c.scaleY,i=Math.cos(e)*c.scaleY,j=1e-6,k=this._pxl,l=this._pyl;j>g&&g>-j&&(g=0),j>h&&h>-j&&(h=0),c.ox=this._pxg-(k*f+l*h),c.oy=this._pyg-(k*g+l*i),this._target.transform("m"+f+","+g+","+h+","+i+","+(c.tx+c.ox)+","+(c.ty+c.oy))}}}),k=j.prototype;k._parseTransform=function(a,c){if(!this._transform){var d,e,j,k,l,m,n,o,p,q=this._transform=g(a,!0),r=1e-6;if("object"==typeof c){if(d={scaleX:h(null!=c.scaleX?c.scaleX:c.scale,q.scaleX),scaleY:h(null!=c.scaleY?c.scaleY:c.scale,q.scaleY),tx:h(c.tx,q.tx),ty:h(c.ty,q.ty)},null!=c.shortRotation){d.rotation="number"==typeof c.shortRotation?c.shortRotation*b:i(c.shortRotation,q.rotation);var s=(d.rotation-q.rotation)%(2*Math.PI);s!==s%Math.PI&&(s+=Math.PI*(0>s?2:-2)),d.rotation=q.rotation+s}else d.rotation=null==c.rotation?q.rotation:"number"==typeof c.rotation?c.rotation*b:i(c.rotation,q.rotation);d.skewX=null==c.skewX?q.skewX:"number"==typeof c.skewX?c.skewX*b:i(c.skewX,q.skewX),d.skewY=null==c.skewY?q.skewY:"number"==typeof c.skewY?c.skewY*b:i(c.skewY,q.skewY),(e=d.skewY-q.skewY)&&(d.skewX+=e,d.rotation+=e),d.skewY<r&&d.skewY>-r&&(d.skewY=0),d.skewX<r&&d.skewX>-r&&(d.skewX=0),d.rotation<r&&d.rotation>-r&&(d.rotation=0),p=c.localPivot||c.globalPivot,"string"==typeof p?(l=p.split(","),m=Number(l[0]),n=Number(l[1])):"object"==typeof p?(m=Number(p.x),n=Number(p.y)):c.localPivot?(l=a.getBBox(!0),m=l.width/2,n=l.height/2):(l=a.getBBox(),m=l.x+l.width/2,n=l.y+l.height/2),c.localPivot?(o=a.matrix,m+=a.attr("x"),n+=a.attr("y"),this._pxl=m,this._pyl=n,this._pxg=m*o.a+n*o.c+o.e-q.tx,this._pyg=m*o.b+n*o.d+o.f-q.ty):(o=a.matrix.invert(),this._pxl=m*o.a+n*o.c+o.e,this._pyl=m*o.b+n*o.d+o.f,this._pxg=m-q.tx,this._pyg=n-q.ty)}else{if("string"!=typeof c)return;l=this._target.transform(),a.transform(c),d=g(a,!1),a.transform(l)}for(j in f)q[j]!==d[j]&&"shortRotation"!==j&&"scale"!==j&&(this._firstPT=k={_next:this._firstPT,t:q,p:j,s:q[j],c:d[j]-q[j],n:j,f:!1,r:!1,b:q[j],e:d[j],type:0},k._next&&(k._next._prev=k),this._overwriteProps.push("raphael_"+j))}}}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();