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

Re: requestAnimationFrame

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 18 Nov 2010 11:30:42 +1300
To: "Gregg Tavares (wrk)" <gman@google.com>
Cc: robert@ocallahan.org, Boris Zbarsky <bzbarsky@mit.edu>, "public-webapps@w3.org" <public-webapps@w3.org>
Message-ID: <20101117223042.GF6812@wok.mcc.id.au>
Gregg Tavares (wrk):
> window.addEventHandler('animationTick", updateAnimations, ...);

I agree that the event name shouldn’t be something related to painting.

> *) Don't render from JS unless visible (ie, don't execute expensive 2d or 3d
> canvas rendering calls when not visible)
> 
> With the caveats of
> 
>   a) Make it extremely easy to do the right thing so that few if any sites
> making canvas ads or canvas games hog the CPU when not visible.
>   b) don't make the browser wait on JavaScript.
>   c) don't render more than needed. (ie, don't render 60 frames a second if
> you're only changing stuff at 15)

Shouldn’t the name of the function be more general than
“setIntervalIfVisible”?  We want the animations to tick slowly not just
when an object isn’t visible, but when it’s the best for the browser’s
overall performance.  I don’t think requestAnimationFrame is too bad of
a name.  It also doesn’t mention painting.

Incidentally, I wonder if the beforepaint/animationTick event could be
dropped altogether.  Why isn’t just the callback sufficient?

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Wednesday, 17 November 2010 22:31:27 GMT

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