Re: requestAnimationFrame

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 UTC