Skip to main content

Bug Tracker

Side navigation

#8101 closed enhancement (fixed)

Opened January 31, 2011 06:24PM UTC

Closed April 10, 2011 09:28PM UTC

Last modified March 19, 2012 09:25PM UTC

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
Blocked by: Blocking:
Description

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

Benefits:

  • 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).

Attachments (0)
Change History (11)

Changed January 31, 2011 06:26PM UTC by lrbabe comment:1

Oops, this is an enhancement, not a bug sorry.

I wish I could fix that by myself.

Changed January 31, 2011 06:29PM UTC by lrbabe comment:2

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

Changed January 31, 2011 06:29PM UTC by jitter comment:3

component: unfiledeffects
priority: undecidedlow
type: bugenhancement

Changed February 06, 2011 04:05PM UTC by snover comment:4

milestone: 1.next
status: newopen

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) :)

Changed February 11, 2011 08:42PM UTC by lrbabe comment:5

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 :-)

Changed April 04, 2011 03:49AM UTC by Daniel Lopez comment:6

Firefox 4 and Chrome 10 are officially out :D

Changed April 04, 2011 04:49PM UTC by ajpiano comment:7

milestone: → 1.6
owner: → jaubourg
priority: lowblocker
status: openassigned

Changed April 04, 2011 05:01PM UTC by ajpiano comment:8

owner: jaubourgtimmywil

Changed April 04, 2011 05:02PM UTC by ajpiano comment:9

cc: → jaubourg

Changed April 04, 2011 11:33PM UTC by timmywil comment:10

Changed April 10, 2011 09:28PM UTC by john comment:11

resolution: → fixed
status: assignedclosed

Landed.