fx.js 4.58 KB
//>>built
define("dojo/_base/lang ./_base ./matrix dojo/_base/Color dojo/_base/array dojo/_base/fx dojo/_base/connect dojo/sniff".split(" "),function(B,q,l,r,t,m,f,C){function u(b,a){this.start=b;this.end=a}function w(b,a,c){this.start=b;this.end=a;this.units=c}function x(b,a){this.start=b;this.end=a;this.temp=new r}function g(b){this.values=b;this.length=b.length}function v(b,a){this.values=b;this.def=a?a:{}}function y(b,a){this.stack=b;this.original=a}function z(b,a,c,e){if(b.values)return new g(b.values);
var d,k;k=b.start?q.normalizeColor(b.start):d=a?c?a[c]:a:e;b.end?b=q.normalizeColor(b.end):(d||(d=a?c?a[c]:a:e),b=d);return new x(k,b)}var p=q.fx={};u.prototype.getValue=function(b){return(this.end-this.start)*b+this.start};w.prototype.getValue=function(b){return(this.end-this.start)*b+this.start+this.units};x.prototype.getValue=function(b){return r.blendColors(this.start,this.end,b,this.temp)};g.prototype.getValue=function(b){return this.values[Math.min(Math.floor(b*this.length),this.length-1)]};
v.prototype.getValue=function(b){var a=B.clone(this.def),c;for(c in this.values)a[c]=this.values[c].getValue(b);return a};y.prototype.getValue=function(b){var a=[];t.forEach(this.stack,function(c){if(c instanceof l.Matrix2D)a.push(c);else if("original"==c.name&&this.original)a.push(this.original);else if("matrix"==c.name){if(c.start instanceof l.Matrix2D&&c.end instanceof l.Matrix2D){var e=new l.Matrix2D,d;for(d in c.start)e[d]=(c.end[d]-c.start[d])*b+c.start[d];a.push(e)}}else c.name in l&&(e=l[c.name],
"function"!=typeof e?a.push(e):(d=t.map(c.start,function(d,a){return(c.end[a]-d)*b+d}),e=e.apply(l,d),e instanceof l.Matrix2D&&a.push(e)))},this);return a};var A=new r(0,0,0,0);p.animateStroke=function(b){b.easing||(b.easing=m._defaultEasing);var a=new m.Animation(b),c=b.shape,e;f.connect(a,"beforeBegin",a,function(){e=c.getStroke();var d=b.color,a={},h;d&&(a.color=z(d,e,"color",A));(d=b.style)&&d.values&&(a.style=new g(d.values));if(d=b.width){var n=d,f=e;n.values?h=new g(n.values):(d=n.start?n.start:
h=f?f.width:1,n.end?h=n.end:"number"!=typeof h&&(h=f?f.width:1),h=new u(d,h));a.width=h}(d=b.cap)&&d.values&&(a.cap=new g(d.values));if(d=b.join)d.values?a.join=new g(d.values):(h=d.start?d.start:e&&e.join||0,d=d.end?d.end:e&&e.join||0,"number"==typeof h&&"number"==typeof d&&(a.join=new u(h,d)));this.curve=new v(a,e)});f.connect(a,"onAnimate",c,"setStroke");return a};p.animateFill=function(b){b.easing||(b.easing=m._defaultEasing);var a=new m.Animation(b),c=b.shape,e;f.connect(a,"beforeBegin",a,function(){e=
c.getFill();var a=b.color;a&&(this.curve=z(a,e,"",A))});f.connect(a,"onAnimate",c,"setFill");return a};p.animateFont=function(b){b.easing||(b.easing=m._defaultEasing);var a=new m.Animation(b),c=b.shape,e;f.connect(a,"beforeBegin",a,function(){e=c.getFont();var a=b.style,k={},h,f;a&&a.values&&(k.style=new g(a.values));(a=b.variant)&&a.values&&(k.variant=new g(a.values));(a=b.weight)&&a.values&&(k.weight=new g(a.values));(a=b.family)&&a.values&&(k.family=new g(a.values));(a=b.size)&&a.units&&(h=parseFloat(a.start?
a.start:c.font&&c.font.size||"0"),f=parseFloat(a.end?a.end:c.font&&c.font.size||"0"),k.size=new w(h,f,a.units));this.curve=new v(k,e)});f.connect(a,"onAnimate",c,"setFont");return a};p.animateTransform=function(b){b.easing||(b.easing=m._defaultEasing);var a=new m.Animation(b),c=b.shape,e;f.connect(a,"beforeBegin",a,function(){e=c.getTransform();this.curve=new y(b.transform,e)});f.connect(a,"onAnimate",c,"setTransform");if("svg"===q.renderer&&(C("ie"),1))var d=[f.connect(a,"onBegin",a,function(){for(var a=
c.getParent();a&&a.getParent;)a=a.getParent();a&&(c.__svgContainer=a.rawNode.parentNode,c.__svgRoot=a.rawNode,c.__svgRoot&&c.__svgRoot.getAttribute&&(c.__svgWidth=parseInt(c.__svgRoot.getAttribute("width"),10),isNaN(c.__svgWidth)&&delete c.__svgWidth))}),f.connect(a,"onAnimate",a,function(){try{if(c.__svgContainer){var a=c.__svgContainer.style.visibility;c.__svgContainer.style.visibility="visible";c.__svgContainer.style.visibility=a;var b=c.__svgWidth;if(!isNaN(b))try{c.__svgRoot.setAttribute("width",
b-5E-6),c.__svgRoot.setAttribute("width",b)}catch(n){}}}catch(n){}}),f.connect(a,"onEnd",a,function(){t.forEach(d,f.disconnect);if(c.__svgContainer){var a=c.__svgContainer;if(null==a.getAttribute("__gotVis")){a.setAttribute("__gotVis",!0);var b=c.__svgContainer.style.visibility,e=c.__svgRoot,g=c.__svgWidth;a.style.visibility="visible";setTimeout(function(){try{a.style.visibility=b;a.removeAttribute("__gotVis");a=null;try{isNaN(g)||(e.setAttribute("width",g-5E-6),e.setAttribute("width",g))}catch(D){}}catch(D){}},
100)}}delete c.__svgContainer;delete c.__svgRoot;delete c.__svgWidth})];return a};return p});