var ColorTrans = function(obj, options){
this._obj = $(obj);
this._timer = null;//Timer
this._index = 0;//Index
this._colors = [];//Color collection
this._grads = new ColorGrads();
(options);
= ();
= ;
this._startColor = || CurrentStyle(this._obj)[];
this._endColor = ;
this._step = ();
();
();
};
= {
//Set default properties
SetOptions: function(options) {
= {//Default value
StartColor: "",//Start color
EndColor: "#000",//End Color
Step: 20, //Gradial Series
Speed: 20,//Gradial speed
CssColor: "color"//Set attributes (Scripting attributes)
};
Extend(, options || {});
},
//Reset the color set
Reset: function(color) {
//After modifying the color, you must re-get the color collection
color = Extend({ StartColor: this._startColor, EndColor: this._endColor, Step: this._step }, color || {});
//Set properties
this._grads.StartColor = this._startColor = ;
this._grads.EndColor = this._endColor = ;
this._grads.Step = this._step = ;
//Get color collection
this._colors = this._grads.Create();
this._index = 0;
},
//The color gradually increases
FadeIn: function() {
(); this._index++; ();
if(this._index < this._colors.length - 1){
this._timer = setTimeout(Bind(this, ), );
}
},
//The color gradually emerges
FadeOut: function() {
(); this._index--; ();
if(this._index > 0){
this._timer = setTimeout(Bind(this, ), );
}
},
//Color setting
SetColor: function() {
var color = this._colors[((0, this._index), this._colors.length - 1)];
this._obj.style[] = "rgb(" + color[0] + "," + color[1] + "," + color[2] + ")";
},
//stop
Stop: function() {
clearTimeout(this._timer);
}
};