function startMove(obj,json,fnEnd)
{
clearInterval(obj.timer);//清除定时器
obj.timer=setInterval(function(){
var bStop=true; //定义全部完成标志
for(var attr in json)
{
var curr='';
if(attr=='opacity') //运动如果是透明度
{
curr=Math.round(parseFloat(_css(obj,'opacity'))*100);
}
else //其他运动情况
{
curr =parseInt(_css(obj,attr));
} //计算速度 基数为6,基数越大,速度越慢
var speed =(json[attr]-curr)/10;
speed=speed>0?Math.ceil(speed):Math.floor(speed); //速度:大于0的向上去整,小于0的向下取整
if(curr!=json[attr])//有一项运动没有完成就为false
{
bStop=false;
}
if(attr=='opacity') //运动如果是透明
{
obj.style.filter='alpha(opacity:'+(curr+speed)+')';
obj.style.opacity=(curr+speed)/100;
}
else
{
obj.style[attr]=curr+speed+'px';
}
} if(bStop)
{
clearInterval(obj.timer);
if(fnEnd) //如果有callback函数
{
fnEnd();
}
}
},30);
}

最新文章

  1. C#开发微信门户及应用(6)--微信门户菜单的管理操作
  2. Android项目实战(二十七):数据交互(信息编辑)填写总结
  3. Spring基础学习笔记-Bean的基础知识
  4. Hello.js – Web 服务授权的 JavaScript SDK
  5. webserver 发布问题
  6. 【DataStructure In Python】Python模拟链表
  7. radio组件
  8. bzoj 2510: 弱题 循环矩阵
  9. 三分钟教你学Git(十六) - 统计
  10. 搭建Hadoop集群(centos6.7+hadoop-2.7.3)
  11. 安装linux环境及相关包方法
  12. dubbo和dubboX与微服务架构(dubbo一)
  13. cocos2d-x 重力感应
  14. VS2012常用快捷键!
  15. script 里写 html 模版
  16. Long与long的区别
  17. node中异步IO的理解
  18. 抓包工具Charles简单使用介绍
  19. some interesting words
  20. 【BZOJ 4151 The Cave】

热门文章

  1. Qt信号槽中槽函数为虚函数的一些感想
  2. js 获取页面高度和宽度(兼容 ie firefox chrome),获取鼠标点击位置
  3. 学c语言做练习之​统计文件中字符的个数
  4. .Net 4.5 Task
  5. IPv6-only 的兼容性解决方案-b
  6. [Android] 获取音频输出getOutput
  7. 使用Qt编写模块化插件式应用程序
  8. mybatis insertUseGeneratedKeys
  9. POJ1321 棋盘问题(dfs)
  10. Symmetric Tree——LeetCode