Bug Tracker

Ticket #8101 (closed enhancement: fixed)

Opened 5 years ago

Last modified 4 years ago

use requestAnimationFrame instead of setInterval for animations, when available

Reported by: lrbabe Owned by: timmywil
Priority: blocker Milestone: 1.6
Component: effects Version: 1.5
Keywords: Cc: jaubourg
Blocking: Blocked by:


requestAnimationFrame is a mechanism meant to tell the browser that you wish to perform an animation; this requests that the browser schedule a repaint of the window for the next animation frame.

Full description here:  https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame


  • let the browser choose the best 'animation tick' rate (instead of our arbitrary 13ms)
  • greatly reduce animation CPU usage when switching tab
  • helps keep animation synchronized

Full list of claimed benefits here:  http://hacks.mozilla.org/2010/08/more-efficient-javascript-animations-with-mozrequestanimationframe/

Currently supported in Firefox, chromium and Chrome dev channel.

Adding it to jQuery is a minor change (7 lines of Javascript).

Change History

comment:1 Changed 5 years ago by lrbabe

Oops, this is an enhancement, not a bug sorry. I wish I could fix that by myself.

comment:2 Changed 5 years ago by lrbabe

And here is the pull request:  https://github.com/jquery/jquery/pull/216

comment:3 Changed 5 years ago by jitter

  • Priority changed from undecided to low
  • Type changed from bug to enhancement
  • Component changed from unfiled to effects

comment:4 Changed 5 years ago by snover

  • Status changed from new to open
  • Milestone 1.next deleted

It’s a very good idea, but probably best implemented in the future when production browser actually support (it instead of only pre-release ones since it could be subject to change) :)

comment:5 Changed 5 years ago by lrbabe

As I said in the pull request, there's absolutely no need to hurry in merging this patch. I wrote it because I had a good idea of how it good fit into jQuery code and I wanted to do some tests.

Of course, merging it doesn't make sense before Firefox4 and Chrome10 are officially out :-)

comment:6 Changed 5 years ago by Daniel Lopez

Firefox 4 and Chrome 10 are officially out :D

comment:7 Changed 5 years ago by ajpiano

  • Owner set to jaubourg
  • Priority changed from low to blocker
  • Status changed from open to assigned
  • Milestone set to 1.6

comment:8 Changed 5 years ago by ajpiano

  • Owner changed from jaubourg to timmywil

comment:9 Changed 5 years ago by ajpiano

  • Cc jaubourg added

comment:11 Changed 5 years ago by john

  • Status changed from assigned to closed
  • Resolution set to fixed


Note: See TracTickets for help on using tickets.