parallaxis/voices/js/plugins/RaphaelPlugin.min.js

13 lines
5.8 KiB
JavaScript
Executable File

/*!
* VERSION: beta 0.14
* DATE: 2012-06-19
* JavaScript
* UPDATES AND DOCS AT: http://www.greensock.com
*
* Copyright (c) 2008-2013, GreenSock. All rights reserved.
* This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
*/
(window._gsQueue||(window._gsQueue=[])).push(function(){_gsDefine("plugins.RaphaelPlugin",["plugins.TweenPlugin","TweenLite"],function(o){var i=function(){o.call(this,"raphael");this._overwriteProps.pop()},k=i.prototype=new o("raphael");k.constructor=i;i.API=2;var p=/[^\d\-\.]/g,j=Math.PI/180,t=/(\d|\.)+/g,q=function(b){return"number"===typeof b?[b>>16,b>>8&255,b&255]:""===b||null==b||"none"===b||"string"!==typeof b?l.transparent:l[b]?l[b]:"#"===b.charAt(0)?(4===b.length&&(b="#"+b.charAt(1)+b.charAt(1)+ b.charAt(2)+b.charAt(2)+b.charAt(3)+b.charAt(3)),b=parseInt(b.substr(1),16),[b>>16,b>>8&255,b&255]):b.match(t)||l.transparent},r={scaleX:1,scaleY:1,tx:1,ty:1,rotation:1,shortRotation:1,skewX:1,skewY:1,scale:1},s=function(b,a){var c=b.matrix,e=c.a,d=c.b,g=c.c,f=c.d,h=a?b._gsTransform||{skewY:0}:{skewY:0},i=0>h.scaleX;h.tx=c.e-(h.ox||0);h.ty=c.f-(h.oy||0);h.scaleX=Math.sqrt(e*e+d*d);h.scaleY=Math.sqrt(f*f+g*g);h.rotation=e||d?Math.atan2(d,e):h.rotation||0;h.skewX=g||f?Math.atan2(g,f)+h.rotation:h.skewX|| 0;Math.abs(h.skewX)>Math.PI/2&&(i?(h.scaleX*=-1,h.skewX+=0>=h.rotation?Math.PI:-Math.PI,h.rotation+=0>=h.rotation?Math.PI:-Math.PI):(h.scaleY*=-1,h.skewX+=0>=h.skewX?Math.PI:-Math.PI));if(1.0E-6>h.rotation&&-1.0E-6<h.rotation&&(e||d))h.rotation=0;if(1.0E-6>h.skewX&&-1.0E-6<h.skewX&&(d||g))h.skewX=0;a&&(b._gsTransform=h);return h},m=function(b,a){return null==b?a:"string"===typeof b&&1===b.indexOf("=")?Number(b.split("=").join(""))+a:Number(b)},n=function(b,a){var c=-1===b.indexOf("rad")?j:1,e=1=== b.indexOf("="),b=Number(b.replace(p,""))*c;return e?b+a:b},l={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]};k._onInitTween=function(b,a,c){if(!b.attr)return!1;this._target=b;this._tween=c; this._props=b._gsProps=b._gsProps||{};var e,d,g,f;for(e in a)(c=a[e],"transform"===e)?this._parseTransform(b,c):r[e]||"pivot"===e?this._parseTransform(b,a):(d=b.attr(e),this._firstPT=g={_next:this._firstPT,t:this._props,p:e,b:d,f:!1,n:"raphael_"+e,r:!1,type:0},"fill"===e||"stroke"===e?(d=q(d),f=q(c),g.e=c,g.s=Number(d[0]),g.c=Number(f[0])-g.s,g.gs=Number(d[1]),g.gc=Number(f[1])-g.gs,g.bs=Number(d[2]),g.bc=Number(f[2])-g.bs,3<d.length||3<f.length?(g.as=4>d.length?1:Number(d[3]),g.ac=(4>f.length?1: Number(f[3]))-g.as,g.type=2):g.type=1):(d="string"===typeof d?parseFloat(d.replace(p,"")):Number(d),"string"===typeof c?(f="="===c.charAt(1),c=parseFloat(c.replace(p,""))):f=!1,g.e=c||0===c?f?c+d:c:a[e],(d||0===d)&&(c||0===c)&&(g.c=f?c:c-d))?g.s=d:(g.type=-1,g.i=a[e],g.s=g.c=0),this._overwriteProps.push("raphael_"+e),g._next&&(g._next._prev=g));return!0};k._parseTransform=function(b,a){if(!this._transform){var c=this._transform=s(b,!0),e,d,g,f,h;if("object"===typeof a){e={scaleX:m(null!=a.scaleX? a.scaleX:a.scale,c.scaleX),scaleY:m(null!=a.scaleY?a.scaleY:a.scale,c.scaleY),tx:m(a.tx,c.tx),ty:m(a.ty,c.ty)};null!=a.shortRotation?(e.rotation="number"===typeof a.shortRotation?a.shortRotation*j:n(a.shortRotation,c.rotation),d=(e.rotation-c.rotation)%(2*Math.PI),d!==d%Math.PI&&(d+=Math.PI*(0>d?2:-2)),e.rotation=c.rotation+d):e.rotation=null==a.rotation?c.rotation:"number"===typeof a.rotation?a.rotation*j:n(a.rotation,c.rotation);e.skewX=null==a.skewX?c.skewX:"number"===typeof a.skewX?a.skewX*j: n(a.skewX,c.skewX);e.skewY=null==a.skewY?c.skewY:"number"===typeof a.skewY?a.skewY*j:n(a.skewY,c.skewY);if(d=e.skewY-c.skewY)e.skewX+=d,e.rotation+=d;1.0E-6>e.skewY&&-1.0E-6<e.skewY&&(e.skewY=0);1.0E-6>e.skewX&&-1.0E-6<e.skewX&&(e.skewX=0);1.0E-6>e.rotation&&-1.0E-6<e.rotation&&(e.rotation=0);f=a.localPivot||a.globalPivot;"string"===typeof f?(f=f.split(","),d=Number(f[0]),f=Number(f[1])):"object"===typeof f?(d=Number(f.x),f=Number(f.y)):a.localPivot?(f=b.getBBox(!0),d=f.width/2,f=f.height/2):(f=b.getBBox(), d=f.x+f.width/2,f=f.y+f.height/2);a.localPivot?(h=b.matrix,d+=b.attr("x"),f+=b.attr("y"),this._pxl=d,this._pyl=f,this._pxg=d*h.a+f*h.c+h.e-c.tx,this._pyg=d*h.b+f*h.d+h.f-c.ty):(h=b.matrix.invert(),this._pxl=d*h.a+f*h.c+h.e,this._pyl=d*h.b+f*h.d+h.f,this._pxg=d-c.tx,this._pyg=f-c.ty)}else if("string"===typeof a&&_transformProp)f=this._target.transform(),b.transform(a),e=s(b,!1),b.transform(f);else return;for(g in r)c[g]!==e[g]&&("shortRotation"!==g&&"scale"!==g)&&(this._firstPT=d={_next:this._firstPT, t:c,p:g,s:c[g],c:e[g]-c[g],n:g,f:!1,r:!1,b:c[g],e:e[g],type:0},d._next&&(d._next._prev=d),this._overwriteProps.push("raphael_"+g))}};k.setRatio=function(b){for(var a=this._firstPT,c;a;)c=a.c*b+a.s,a.r&&(c=0<c?c+0.5>>0:c-0.5>>0),a.type?1===a.type?a.t[a.p]="rgb("+(c>>0)+", "+(a.gs+b*a.gc>>0)+", "+(a.bs+b*a.bc>>0)+")":2===a.type?a.t[a.p]="rgba("+(c>>0)+", "+(a.gs+b*a.gc>>0)+", "+(a.bs+b*a.bc>>0)+", "+(a.as+b*a.ac)+")":-1===a.type&&(a.t[a.p]=a.i):a.t[a.p]=c,a=a._next;this._target.attr(this._props);if(this._transform){a= this._transform;c=a.rotation;var e=c-a.skewX,b=Math.cos(c)*a.scaleX;c=Math.sin(c)*a.scaleX;var d=Math.sin(e)*-a.scaleY,e=Math.cos(e)*a.scaleY,g=this._pxl,f=this._pyl;1.0E-6>c&&-1.0E-6<c&&(c=0);1.0E-6>d&&-1.0E-6<d&&(d=0);a.ox=this._pxg-(g*b+f*d);a.oy=this._pyg-(g*c+f*e);this._target.transform("m"+b+","+c+","+d+","+e+","+(a.tx+a.ox)+","+(a.ty+a.oy))}};o.activate([i]);return i},!0)});window._gsDefine&&_gsQueue.pop()();