天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

JS Tween 顏色漸變

有31中緩動算法,實現了顏色的自動轉換(#f00 #ff0000 rgb(255,0,0)格式到顏色運算格式,最后返回#ff0000格式)、px單位的自動轉換。
調用接口:
/**
* 對外接口
* Tween的示例
* @param startProps 開始屬性,單個屬性或者數組
* @param endProps 結束屬性,單個屬性或者數組
* @param timeSeconds 運動消耗時間,單位秒
* @param animType 動作類型,字符串型,內部自己轉換算子
* @param delay 延遲時間,多長時間后開始運動,單位秒
*/
window.rtween = function(startProps, endProps, timeSeconds, animType, delay)
{
var tw = new Tween();
tw.start(startProps, endProps, timeSeconds, animType, delay);
return tw;
}
示例如下:
http://img.jb51.NET/online/Tween.htm

[Ctrl+A 全選 注:如需引入外部Js需刷新才能執行]
選擇列表里面的緩動算法,點前面的按鈕,就會以想對的緩動算法運動

源代碼: http://img.jb51.NET/jslib/jquery/rtween.js
核心代碼:
function Tween()
{
this._frame=20;
//
this._animType = linear;
this._delay = 0;
//
this.run = function(){}
this.complete = function(){}
}
//
Tween.prototype.getValue = function(prop)
{
this._valueType = ”;
if(prop.constructor == Array) return prop;
//
if(typeof(prop) == 'string')
{
if(isColor(prop))
{
this._valueType = ‘color';
return c2a(prop);
}
if(prop.split('px').length>1)
{
this._valueType = ‘px';
return [prop.split('px')[0]];
}
}
return [prop];
}
Tween.prototype.setValue = function(prop)
{
if(this._valueType == ‘color')return a2c(prop);
if(this._valueType == ‘px')return prop[0]+'px';
return prop;
}
Tween.prototype.start = function(startProps, endProps, timeSeconds, animType, delay)
{
if(animType != undefined)this._animType = this.animTypes[animType];
if(delay != undefined)this._delay = delay;
//
this._timeSeconds = timeSeconds;
this._startTimer = new Date().getTime() + this._delay * 1000;
//
this._endProps = this.getValue(endProps);
this._startProps = this.getValue(startProps);
this._currentProps = [];
//
var $this = this;
clearInterval(this._runID);
this._runID = setInterval(
function(){$this._run();}
,this._frame);
}
Tween.prototype.stop = function(state)
{
for(var i in this._startProps)
{
if(Number(state)>0)
this._currentProps[i] = this._endProps[i];
else if(Number(state)<0)
this._currentProps[i] = this._startProps[i];
}
this.callListener();
this.complete();
//
clearInterval(this._runID);
}
Tween.prototype.callListener = function()
{
this.run(this.setValue(this._currentProps));
}
Tween.prototype._run = function()
{
if ( new Date().getTime()- this._startTimer< 0) return;
var isEnd = false;
//
for(var i in this._startProps)
{
this._currentProps[i] = this._animType( new Date().getTime()-this._startTimer,Number(this._startProps[i]),Number(this._endProps[i])-Number(this._startProps[i]),this._timeSeconds * 1000);
//
if(this._startTimer + (this._timeSeconds * 1000) <= new Date().getTime())
{
this._currentProps[i] = this._endProps[i];
isEnd = true;
}
}
//
if(isEnd)this.stop();
else this.callListener();
}

JavaScript技術JS Tween 顏色漸變,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 青娱乐极品视觉盛宴av | 国产在线高清视频无码不卡 | 翘臀少妇被扒开屁股日出水爆乳 | 免费精品一区二区三区AA片 | 国产精品久久人妻拍拍水牛影视 | 日本久久高清视频 | 爽爽影院免费观看 | 97在线视频免费 | 好紧好湿太硬了我太爽了文字 | 韩国甜性涩爱 | 狠狠鲁快播 | 欧美三级黄色大片 | 视频在线免费观看 | 国产一区二区青青精品久久 | 俄罗斯videosbest8| 久久亚洲精品无码A片大香大香 | 最近中文字幕2019国语4 | 亚洲欧美中文字幕网站大全 | 恋夜直播午夜秀场最新 | 东京热影院 | 无颜之月5集全免费看无删除 | 国产成人精品电影在线观看 | 日本久久久久亚洲中字幕 | 国产亚洲精品AAAAAAA片 | 亚洲精品在线影院 | 99久久无码一区人妻A片竹菊 | 蜜臀AV精品一区二区三区 | 欧美精品专区免费观看 | 亚洲欧美免费无码专区 | 色百度网址大全 | 日本女人下面毛茸茸 | 男欢女爱免费视频 | 久久精品手机观看 | 动漫在线观看免费肉肉 | 怡红院美国分院一区二区 | 毛片在线全部免费观看 | 97夜夜澡人人爽人人模人人喊 | 久青草国产在线视频亚瑟影视 | 蜜柚在线观看免费高清官网视频 | 国产精品亚洲视频在线观看 | 男人J桶进男人屁股过程 |