继snakeGame之后,自己又写了一下flappyBird,还是很有意思的。
requestAnimationFrame() 浏览器提供的API,相比较定时器来循环间隔移动目标物体,有优化更合理,呈现更流畅的动画,当该标签页不可见,浏览器会暂停它,从而减少系统压力。
结构
HTML
|
|
JS
|
|
继snakeGame之后,自己又写了一下flappyBird,还是很有意思的。
requestAnimationFrame() 浏览器提供的API,相比较定时器来循环间隔移动目标物体,有优化更合理,呈现更流畅的动画,当该标签页不可见,浏览器会暂停它,从而减少系统压力。
|
|
|
|