root / trunk / web / dojo / dojox / charting / action2d / Shake.js @ 13
History | View | Annotate | Download (1.76 KB)
1 |
/*
|
---|---|
2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
4 |
see: http://dojotoolkit.org/license for details
|
5 |
*/
|
6 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.charting.action2d.Shake"]){ |
9 |
dojo._hasResource["dojox.charting.action2d.Shake"]=true; |
10 |
dojo.provide("dojox.charting.action2d.Shake");
|
11 |
dojo.require("dojox.charting.action2d.Base");
|
12 |
dojo.require("dojox.gfx.matrix");
|
13 |
dojo.require("dojo.fx");
|
14 |
(function(){
|
15 |
var _1=3,m=dojox.gfx.matrix,gf=dojox.gfx.fx; |
16 |
dojo.declare("dojox.charting.action2d.Shake",dojox.charting.action2d.Base,{defaultParams:{duration:400,easing:dojo.fx.easing.backOut,shiftX:_1,shiftY:_1},optionalParams:{},constructor:function(_2,_3,_4){ |
17 |
if(!_4){
|
18 |
_4={}; |
19 |
} |
20 |
this.shiftX=typeof _4.shiftX=="number"?_4.shiftX:_1; |
21 |
this.shiftY=typeof _4.shiftY=="number"?_4.shiftY:_1; |
22 |
this.connect();
|
23 |
},process:function(o){ |
24 |
if(!o.shape||!(o.type in this.overOutEvents)){ |
25 |
return;
|
26 |
} |
27 |
var _5=o.run.name,_6=o.index,_7=[],_8,_9=o.type=="onmouseover"?this.shiftX:-this.shiftX,_a=o.type=="onmouseover"?this.shiftY:-this.shiftY; |
28 |
if(_5 in this.anim){ |
29 |
_8=this.anim[_5][_6];
|
30 |
}else{
|
31 |
this.anim[_5]={};
|
32 |
} |
33 |
if(_8){
|
34 |
_8.action.stop(true);
|
35 |
}else{
|
36 |
this.anim[_5][_6]=_8={};
|
37 |
} |
38 |
var _b={shape:o.shape,duration:this.duration,easing:this.easing,transform:[{name:"translate",start:[this.shiftX,this.shiftY],end:[0,0]},m.identity]}; |
39 |
if(o.shape){
|
40 |
_7.push(gf.animateTransform(_b)); |
41 |
} |
42 |
if(o.oultine){
|
43 |
_b.shape=o.outline; |
44 |
_7.push(gf.animateTransform(_b)); |
45 |
} |
46 |
if(o.shadow){
|
47 |
_b.shape=o.shadow; |
48 |
_7.push(gf.animateTransform(_b)); |
49 |
} |
50 |
if(!_7.length){
|
51 |
delete this.anim[_5][_6]; |
52 |
return;
|
53 |
} |
54 |
_8.action=dojo.fx.combine(_7); |
55 |
if(o.type=="onmouseout"){ |
56 |
dojo.connect(_8.action,"onEnd",this,function(){ |
57 |
if(this.anim[_5]){ |
58 |
delete this.anim[_5][_6]; |
59 |
} |
60 |
}); |
61 |
} |
62 |
_8.action.play(); |
63 |
}}); |
64 |
})(); |
65 |
} |