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

12 lines
5.6 KiB
JavaScript
Raw Normal View History

2020-11-09 19:43:39 +01:00
/*!
* VERSION: 0.2.2
* DATE: 2018-02-15
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2018, 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==