亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JavaScript 顏色梯度和漸變效果第3/3頁(yè)

 更新時(shí)間:2009年03月15日 21:15:07   作者:  
程序ColorGrads的作用是通過(guò)StartColor和EndColor生成顏色梯度集合。

ColorTrans部分:
復(fù)制代碼 代碼如下:

var ColorTrans = function(obj, options){

this._obj = $(obj);
this._timer = null;//定時(shí)器
this._index = 0;//索引
this._colors = [];//顏色集合
this._grads = new ColorGrads();

this.SetOptions(options);

this.Speed = Math.abs(this.options.Speed);
this.CssColor = this.options.CssColor;

this._startColor = this.options.StartColor || CurrentStyle(this._obj)[this.CssColor];
this._endColor = this.options.EndColor;
this._step = Math.abs(this.options.Step);

this.Reset();
this.SetColor();
};
ColorTrans.prototype = {
//設(shè)置默認(rèn)屬性
SetOptions: function(options) {
this.options = {//默認(rèn)值
StartColor: "",//開(kāi)始顏色
EndColor: "#000",//結(jié)束顏色
Step: 20,//漸變級(jí)數(shù)
Speed: 20,//漸變速度
CssColor: "color"http://設(shè)置屬性(Scripting屬性)
};
Extend(this.options, options || {});
},
//重設(shè)顏色集合
Reset: function(color) {
//修改顏色后必須重新獲取顏色集合
color = Extend({ StartColor: this._startColor, EndColor: this._endColor, Step: this._step }, color || {});
//設(shè)置屬性
this._grads.StartColor = this._startColor = color.StartColor;
this._grads.EndColor = this._endColor = color.EndColor;
this._grads.Step = this._step = color.Step;
//獲取顏色集合
this._colors = this._grads.Create();
this._index = 0;
},
//顏色漸入
FadeIn: function() {
this.Stop(); this._index++; this.SetColor();
if(this._index < this._colors.length - 1){
this._timer = setTimeout(Bind(this, this.FadeIn), this.Speed);
}
},
//顏色漸出
FadeOut: function() {
this.Stop(); this._index--; this.SetColor();
if(this._index > 0){
this._timer = setTimeout(Bind(this, this.FadeOut), this.Speed);
}
},
//顏色設(shè)置
SetColor: function() {
var color = this._colors[Math.min(Math.max(0, this._index), this._colors.length - 1)];
this._obj.style[this.CssColor] = "rgb(" + color[0] + "," + color[1] + "," + color[2] + ")";
},
//停止
Stop: function() {
clearTimeout(this._timer);
}
};


[Ctrl+A 全選 注:引入外部Js需再刷新一下頁(yè)面才能執(zhí)行]

相關(guān)文章

  • js如何驗(yàn)證密碼強(qiáng)度

    js如何驗(yàn)證密碼強(qiáng)度

    這篇文章主要為大家詳細(xì)介紹了js如何驗(yàn)證密碼強(qiáng)度,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-03-03
  • 用JavaScript調(diào)用WebService的示例

    用JavaScript調(diào)用WebService的示例

    JavaScript用htc實(shí)現(xiàn)WebService的調(diào)用
    2008-04-04
  • js中Image對(duì)象以及對(duì)其預(yù)加載處理示例

    js中Image對(duì)象以及對(duì)其預(yù)加載處理示例

    現(xiàn)在的網(wǎng)頁(yè)中經(jīng)常會(huì)有一些圖像連接,當(dāng)鼠標(biāo)指向它的時(shí)候,圖像換成另外一幅圖像,它們都是先預(yù)讀圖像的,下面也有個(gè)不錯(cuò)的實(shí)例,感興趣的朋友可以參考下
    2013-11-11
  • 微信小程序國(guó)際化探索實(shí)現(xiàn)(附源碼地址)

    微信小程序國(guó)際化探索實(shí)現(xiàn)(附源碼地址)

    這篇文章主要介紹了微信小程序國(guó)際化探索實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-05-05
  • JavaScript canvas實(shí)現(xiàn)七彩太陽(yáng)光暈效果

    JavaScript canvas實(shí)現(xiàn)七彩太陽(yáng)光暈效果

    這篇文章主要為大家詳細(xì)介紹了JavaScript canvas實(shí)現(xiàn)七彩太陽(yáng)光暈效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-05-05
  • JavaScript Promise 用法

    JavaScript Promise 用法

    “Promises”漸漸成為JavaScript里最重要的一部分,大量的新API都開(kāi)始promise原理實(shí)現(xiàn)。這篇文章主要為大家詳細(xì)介紹了JavaScript Promise 用法,感興趣的小伙伴們可以參考一下
    2016-06-06
  • JS 中document.write()的用法和清空的原因淺析

    JS 中document.write()的用法和清空的原因淺析

    這篇文章主要介紹了JS 中document.write()的用法和清空的原因淺析,需要的朋友可以參考下
    2017-12-12
  • JS實(shí)現(xiàn)漂亮的時(shí)間選擇框效果

    JS實(shí)現(xiàn)漂亮的時(shí)間選擇框效果

    這篇文章主要介紹了JS實(shí)現(xiàn)漂亮的時(shí)間選擇框效果,結(jié)合實(shí)例形式分析了javascript時(shí)間選擇框插件的實(shí)現(xiàn)與使用方法,需要的朋友可以參考下
    2016-08-08
  • js實(shí)現(xiàn)跨域的幾種方法匯總(圖片ping、JSONP和CORS)

    js實(shí)現(xiàn)跨域的幾種方法匯總(圖片ping、JSONP和CORS)

    平時(shí)用慣了jQuery.ajax之類的方法,卻時(shí)常忽略了它背后的實(shí)現(xiàn),本文是學(xué)習(xí)了AJAX基礎(chǔ)及幾種跨域解決方案之后的一些收獲。
    2015-10-10
  • 11種JavaScript前端數(shù)據(jù)去重方式總結(jié)

    11種JavaScript前端數(shù)據(jù)去重方式總結(jié)

    這篇文章主要為大家總結(jié)了JavaScript去重的11種方式,各有優(yōu)缺點(diǎn),文中的示例代碼講解詳細(xì),具有一定的學(xué)習(xí)價(jià)值,需要的可以根據(jù)需求合理使用
    2023-06-06

最新評(píng)論