root/afridex/plugins/Flutter/js/greybox/AJS_fx.js

Revision 21, 3.1 kB (checked in by admin, 18 years ago)
Line 
1AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){
2var _3=new AJS.fx.Base();
3_3.elm=AJS.$(_1);
4_3.options.duration=600;
5_3.setOptions(_2);
6AJS.update(_3,{increase:function(){
7if(this.now==7){
8_1.style.backgroundColor="#fff";
9}else{
10_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];
11}
12}});
13return _3.custom(6,0);
14},fadeIn:function(_4,_5){
15_5=_5||{};
16if(!_5.from){
17_5.from=0;
18AJS.setOpacity(_4,0);
19}
20if(!_5.to){
21_5.to=1;
22}
23var s=new AJS.fx.Style(_4,"opacity",_5);
24return s.custom(_5.from,_5.to);
25},fadeOut:function(_7,_8){
26_8=_8||{};
27if(!_8.from){
28_8.from=1;
29}
30if(!_8.to){
31_8.to=0;
32}
33_8.duration=300;
34var s=new AJS.fx.Style(_7,"opacity",_8);
35return s.custom(_8.from,_8.to);
36},setWidth:function(_a,_b){
37var s=new AJS.fx.Style(_a,"width",_b);
38return s.custom(_b.from,_b.to);
39},setHeight:function(_d,_e){
40var s=new AJS.fx.Style(_d,"height",_e);
41return s.custom(_e.from,_e.to);
42}};
43AJS.fx.Base=new AJS.Class({init:function(_10){
44this.options={onStart:function(){
45},onComplete:function(){
46},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50};
47AJS.update(this.options,_10);
48AJS.bindMethods(this);
49},setOptions:function(_11){
50AJS.update(this.options,_11);
51},step:function(){
52var _12=new Date().getTime();
53if(_12<this.time+this.options.duration){
54this.cTime=_12-this.time;
55this.setNow();
56}else{
57setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);
58this.clearTimer();
59this.now=this.to;
60}
61this.increase();
62},setNow:function(){
63this.now=this.compute(this.from,this.to);
64},compute:function(_13,to){
65var _15=to-_13;
66return this.options.transition(this.cTime,_13,_15,this.options.duration);
67},clearTimer:function(){
68clearInterval(this.timer);
69this.timer=null;
70return this;
71},_start:function(_16,to){
72if(!this.options.wait){
73this.clearTimer();
74}
75if(this.timer){
76return;
77}
78setTimeout(AJS.$p(this.options.onStart,this.elm),10);
79this.from=_16;
80this.to=to;
81this.time=new Date().getTime();
82this.timer=setInterval(this.step,Math.round(1000/this.options.fps));
83return this;
84},custom:function(_18,to){
85return this._start(_18,to);
86},set:function(to){
87this.now=to;
88this.increase();
89return this;
90},setStyle:function(elm,_1c,val){
91if(this.property=="opacity"){
92AJS.setOpacity(elm,val);
93}else{
94AJS.setStyle(elm,_1c,val);
95}
96}});
97AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1f,_20){
98this.parent();
99this.elm=elm;
100this.setOptions(_20);
101this.property=_1f;
102},increase:function(){
103this.setStyle(this.elm,this.property,this.now);
104}});
105AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_22){
106this.parent();
107this.elm=AJS.$(elm);
108this.setOptions(_22);
109this.now={};
110},setNow:function(){
111for(p in this.from){
112this.now[p]=this.compute(this.from[p],this.to[p]);
113}
114},custom:function(obj){
115if(this.timer&&this.options.wait){
116return;
117}
118var _24={};
119var to={};
120for(p in obj){
121_24[p]=obj[p][0];
122to[p]=obj[p][1];
123}
124return this._start(_24,to);
125},increase:function(){
126for(var p in this.now){
127this.setStyle(this.elm,p,this.now[p]);
128}
129}});
130AJS.fx.Transitions={linear:function(t,b,c,d){
131return c*t/d+b;
132},sineInOut:function(t,b,c,d){
133return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
134}};
135script_loaded=true;
136
137
138script_loaded=true;
Note: See TracBrowser for help on using the browser.