zoukankan      html  css  js  c++  java
  • 匀速运动

    匀速运动
    function startMove(target){
              clearInterval( timer );
              timer = setInterval( function(){
                  var speed = target - oDiv.offsetLeft>0 ? 7  : -7;
                  if( Math.abs( target - oDiv.offsetLeft ) <  7 ){
                       oDiv.style.left = target + "px";
                       clearInterval( timer );
                  }else{
                       oDiv.style.left = oDiv.offsetLeft +  speed + "px";
                  }
              },30 )
         }
     
    匀速透明运动
    var alpha = 30;// 操作透明度的变化
    function startMove(target){
              clearInterval( timer );
              timer = setInterval( function(){
                  var speed = target-alpha>0 ? 1 : -1;
                  if( target == alpha ){
                       clearInterval( timer );
                  }else{
                       alpha += speed;
                       oDiv.style.opacity =  alpha/100;
                  }
              },30 )
         }
  • 相关阅读:
    人生苦短,我用python!
    Pycharm快捷键
    查看java进程
    带你掌握Arthas
    高并发场景下System.currentTimeMillis()的性能问题的优化
    SpringBoot整合Dubbo&ZooKeeper
    CentOS7下yum安装Mysql5.7
    SpringCache整合Redis实现自定义缓存时间
    Java开发神器lombok
    CentOS7安装Nginx
  • 原文地址:https://www.cnblogs.com/tis100204/p/10297447.html
Copyright © 2011-2022 走看看