当前位置: 代码迷 >> Web前端 >> 几种加减速运动成效
  详细解决方案

几种加减速运动成效

热度:246   发布时间:2012-09-06 10:37:01.0
几种加减速运动效果

                   
                                                                 #box{position:absolute;background:#00CC00;border:1px solid #003300;width:50px;height:50px;top:100px;}客服果果=document.getElementById('box');要走的总路程=document.body.clientWidth-客服果果.offsetWidth;setInterval(function (){var 下一次预计累计距离=parseInt(box.style.left)*1.2;if(下一次预计累计距离>要走的总路程)下一次预计累计距离=要走的总路程;客服果果.style.left=下一次预计累计距离;},20) b=1;m=document.body.offsetWidth-120;t=truesetInterval("c=parseFloat(a.style.left);if(c>m){t=false}else if(cb=1;m=document.body.offsetWidth-120;t=truesetInterval("c=parseFloat(a.style.left);if(c>m){t=false;b=1}else if(cfunction move(){var impetus=0.01;var moveArea={left:0,right:600};var obj=document.getElementById("img1");obj.direction=1;obj.speed=1;obj.maxSpeed=100;obj.interval=0;function startMove(){if(parseInt(obj.style.left)moveArea.right){obj.style.left=parseInt(obj.style.left)obj.direction=parseInt(obj.style.left)}obj.style.left=parseFloat(obj.style.left)+obj.direction*obj.speed+"px";obj.speed=obj.speed>obj.maxSpeed?1:obj.speed*(1+impetus);}setInterval(startMove,10);}
  相关解决方案