• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Request animateframe初探
 

Request animateframe初探

on

  • 749 views

 

Statistics

Views

Total Views
749
Views on SlideShare
583
Embed Views
166

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 166

http://wd.alibaba-inc.com 106
http://fd.aliued.cn 60

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Request animateframe初探 Request animateframe初探 Presentation Transcript

    • requestAnimateFrame初探
      ——洪珊珊
    • 使用方法
      requestAnimateFrame([callback])
      回调函数的第一个参数timestamp,为当前时间
    • 示例
      requestAnimateFrame示例
      setInterval /setTimeout示例
    • 据说
      多个定时器之间的调度会对性能有轻微的影响
      对于一个帧中对DOM的所有操作,只进行一次Layout和Paint
      如果发生动画的元素被隐藏了,那么就不再去Paint
    • 兼容性
      requestAnimationFrame = window.requestAnimationFrame ||
      window.mozRequestAnimationFrame ||
      window.webkitRequestAnimationFrame ||
      window.msRequestAnimationFrame ||
      window.oRequestAnimationFrame ||
      function(callback) { setInterval(callback, 1000 / 60); };
    • 参阅资料
      https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame
      http://www.chromium.org/developers/design-documents/requestanimationframe-implementation
      http://webstuff.nfshost.com/anim-timing/Overview.html