缓冲运动 学习笔记

http://bbs.zhinengshe.com/thread-1195-1-1.html

 

要求:速度逐渐变慢,直到停止。

运行效果:[http://runjs.cn/code/wju7kucq]

 

问题:物体无法运动到准确的位置[http://runjs.cn/code/i5cbxnxn]

原因:像素不能为小数,因此会被不断的取整,从而达不到准确位置;

解决方案:使用ceil()或floor()对速度进行取整; 

运行效果:[http://runjs.cn/detail/r4wofiz8]

posted @ 2015-06-04 12:21  林大勇  阅读(151)  评论(0)    收藏  举报