<script> function Animation(target,targetProperty,closure,precisi " /> 中文字幕黄色,自拍偷拍一区二区三区,av在线大全

中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

javascript動畫效果類封裝代碼

<input id=output3 style="position:absolute;top:300;left:300;"/>
<input id=output1 />
<input id=output2 />
<br/>
<input id=output4 />

<script>
function Animation(target,targetProperty,closure,precision)
{
  closure=closure||function(x){return x;};
  precision=precision||10;
  this.handle;

  var beginTime=new Date();
  var stopTime=new Date();
  this.Begin=function(){
    beginTime=new Date();
    this.handle=setInterval(
      function(){
        var now=new Date();
        target[targetProperty]=closure(now.getTime()-beginTime.getTime());
      },
      precision
    );
       }

  this.Continue=function(){
    var now=new Date();
    beginTime.setTime(now.getTime()-stopTime.getTime()+beginTime.getTime());

    this.handle=setInterval(
      function(){
        var now=new Date();
        target[targetProperty]=closure(now.getTime()-beginTime.getTime());
      },
      precision
    );
  }

  this.Stop=function(duration){

    clearInterval(this.handle);

    if(duration===undefined)
    {
      stopTime=new Date();
      duration=stopTime.getTime()-beginTime.getTime();
    }
    else stopTime.setTime(beginTime.getTime()+duration)
    target[targetProperty]=closure(duration);
  }
}

function StoryBoard(Duration,onfinish,flag)
{
  onfinish=onfinish||function(){};
  var r=new Array();
  r.appendAnimation=function(animation)
  {
    if(animation instanceof Animation)
      this.push(animation);
  }
  r.removeAnimation=function(animation)
  {
    for(var i=0;i<r.length;i++)
    {
      if(r[i]==animation)
      {
        r.splice(i,1);
        break;
      }
    }
  }
  r.start=function(){    
    for(var i=0;i<r.length;i++)
    {
      r[i].Begin();
    }
    setTimeout(
      function(){
        for(var i=0;i<r.length;i++)
        {
          r[i].Stop(Duration);
        }
      },
      Duration
    );
    onfinish();
  }
  return r;

}
//////////////////////////////下面是使用方法////////////////////////////////
function $(id)
{
   return document.getElementById(id);
}
var a1=new Animation($("output1"),"value");
var a2=new Animation($("output2"),"width",function(x){return Math.floor(x/10);});
var a3=new Animation($("output3").style,"filter",function(x){return "alpha(opacity="+Math.floor(x/5000*100)+")";});
var a4=new Animation($("output4").style,"width",function(x){return Math.floor(x*x*x/50000/5000)+"px";});
var s=new StoryBoard(5000);
s.appendAnimation(a1);
s.appendAnimation(a2);
s.appendAnimation(a3);
s.appendAnimation(a4);
s.start();

</script>
<pre>
output1是改變value
output1是改變寬度
output3是淡入
output4是帶緩動的寬度
</pre>

JavaScript技術javascript動畫效果類封裝代碼,轉載需保留來源!

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

主站蜘蛛池模板: 欧美一区二区三区四区五区无卡码 | 日韩欧美中文 | 日本成人综合 | 欧美性成人 | 久久夜视频 | 最新伦理片 | 亚州影院| 亚洲精品综合 | 午夜欧美 | 国产高清在线精品 | 亚洲国产精品suv | 欧美中文字幕一区二区三区亚洲 | 性色视频在线观看 | 一区在线播放 | 99热在线观看精品 | 国产日韩精品在线 | 国产成人精品区一区二区不卡 | 国产一区视频在线 | 国产精品久久久久久二区 | 成人av网站在线观看 | 中文字幕亚洲精品 | av中文字幕在线观看 | 中文字幕中文字幕 | 国产在线一级片 | 一区二区三区不卡视频 | 国产精品1区2区3区 中文字幕一区二区三区四区 | www国产亚洲精品久久网站 | 精品视频一区二区 | 狠狠干美女 | 久久久国产精品 | av高清 | 干出白浆视频 | 国产激情视频在线 | 中国一级特黄真人毛片 | 免费av毛片 | 欧美国产精品 | 久久com | 97国产爽爽爽久久久 | 欧美99久久精品乱码影视 | 国产一级片网站 | 亚洲精品福利在线 |