您的位置:时时彩走势图 > 重庆时时五星彩走势图-服务器运维 > 实现了颜色的自动转换(

实现了颜色的自动转换(

2020-02-01 08:13

有31中缓动算法,实现了颜色的自动转换(#f00 #ff0000 rgb格式到颜色运算格式,最后返回#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; } 示例如下:

function alpha2() { var t = rtween; t.run = function.css; } t.complete = function() { rtween.run = function.css; } } }

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]选择列表里面的缓动算法,点前面的按钮,就会以想对的缓动算法运动 源代码: : function Tween() { this._frame=20; // this._animType = linear; this._delay = 0; // this.run = function(){} this.complete = function(){} } // Tween.prototype.getValue = function { this._valueType = ”; if(prop.constructor == Array) return prop; // if == 'string') { if { this._valueType = ‘color'; return c2a; } if.length>1) { this._valueType = ‘px'; return [prop.split[0]]; } } return [prop]; } Tween.prototype.setValue = function { if(this._valueType == ‘color')return a2c; 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]; ifthis._delay = delay; // this._timeSeconds = timeSeconds; this._startTimer = new Date + this._delay * 1000; // this._endProps = this.getValue; this._startProps = this.getValue; this._currentProps = []; // var $this = this; clearInterval; this._runID = setInterval{$this._run; } Tween.prototype.stop = function { for(var i in this._startProps) { if this._currentProps[i] = this._endProps[i]; else if this._currentProps[i] = this._startProps[i]; } this.callListener; // clearInterval; } Tween.prototype.callListener = function() { this.run(this.setValue; } Tween.prototype._run = function.getTime()- this._startTimer< 0) return; var isEnd = false; // for(var i in this._startProps) { this._currentProps[i] = this._animType-this._startTimer,Number,Number-Number,this._timeSeconds * 1000); // if(this._startTimer + (this._timeSeconds * 1000) <= new Date { this._currentProps[i] = this._endProps[i]; isEnd = true; } } // if; else this.callListener(); }

本文由时时彩走势图发布于重庆时时五星彩走势图-服务器运维,转载请注明出处:实现了颜色的自动转换(

关键词: