W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Re: requestAnimationFrame

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 15 Nov 2010 21:27:34 -0800
Message-ID: <AANLkTi=922iWkp4aWTbMuNMv0RJ0H48jdgFZ6Hg+SC7J@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "Gregg Tavares (wrk)" <gman@google.com>, "public-webapps@w3.org" <public-webapps@w3.org>
On Mon, Nov 15, 2010 at 6:17 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 11/15/10 6:55 PM, Gregg Tavares (wrk) wrote:
>>
>> How would setInterval with multiple functions on
>> mozRequestAnimationFrame solve this issue? They are still all going to
>> get called at the fastest interval right?
>
> Why?
>
> setInterval(function() {
>  window.requestAnimationFrame(function redrawElem1() { /* ... */ });
> }, 33);
> setInterval(function() {
>  window.requestAnimationFrame(function redrawElem2() { /* ... */ });
> }, 100);

My suggestion is that

window.requestAnimationFrame(function redrawElem1() { ... }, 33);
window.requestAnimationFrame(function redrawElem1() { ... }, 100);

would be equivalent to the above (or rather, would be equivalent to
using setTimeout).

Though maybe limited-rate animations aren't common enough that the
short-hand is needed.

/ Jonas
Received on Tuesday, 16 November 2010 05:28:32 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:42 GMT