W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: The need to re-subscribe to requestAnimationFrame

From: Glenn Maynard <glenn@zewt.org>
Date: Sat, 2 Mar 2013 08:15:03 -0600
Message-ID: <CABirCh__rZpMrof5ouuBPjgB8q6k08QfFuRNvxGYuFTeWSaiEw@mail.gmail.com>
To: David Bruant <bruant.d@gmail.com>
Cc: Webapps WG <public-webapps@w3.org>
On Sat, Mar 2, 2013 at 5:03 AM, David Bruant <bruant.d@gmail.com> wrote:

> If someone wants to reuse the same function for requestionAnimationFrame,
> he/she has to go through:
>     requestAnimationFrame(function f(){
>         requestAnimationFrame(f);
>         // do stuff
>     })
>

FYI, this pattern is cleaner, so you only have to call
requestAnimationFrame in one place:

function draw() {
    // render
    requestAnimationFrame(draw);
}
draw();

-- 
Glenn Maynard
Received on Saturday, 2 March 2013 14:15:30 GMT

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