W3C home > Mailing lists > Public > public-web-perf@w3.org > May 2011

Re: [AnimationRequestFrame] Initial editor's draft of AnimationRequestFrame spec available

From: James Robinson <jamesr@google.com>
Date: Mon, 2 May 2011 20:05:38 -0700
Message-ID: <BANLkTi=-Gd6eJjr-EHRnMkLF053bth_67A@mail.gmail.com>
To: Jatinder Mann <jmann@microsoft.com>
Cc: "public-web-perf@w3.org" <public-web-perf@w3.org>
On Mon, May 2, 2011 at 6:16 PM, Jatinder Mann <jmann@microsoft.com> wrote:

>  James, thanks for getting the spec on to http://dvcs.w3.org/hg/webperf. I
> have some feedback on the current draft:
>
> 2.       To increase adoption of the requestFrameAnimation(), it should be
> syntactically similar to window.setInterval() or window.setTimeout(). This
> means that in addition to taking a FrameRequestCallback, we should also
> allow inline script and additional arguments. For example,
>
>
>

I agree with Boris and Jonas that these are not needed.  In addition to what
they have already said, the additional arguments feature of
window.setTimeout/setInterval is almost never used in practice because it is
not interoperable (IE8 and below ignore it, Firefox adds an extra parameter
in addition to those specified
https://developer.mozilla.org/en/window.setTimeout see 'note').  I did
verify that this syntax is close enough to a drop-in replacement for common
JavaScript libraries that currently use setTimeout or setInterval and in
fact several libraries, such as jQuery, are using requestAnimationFrame when
it is available instead of setTimeout or setInterval.


>
> 3.       The specification should be clear that the element argument in
> the requestAnimationFrame method should be optional and not a normative
> requirement. I recommend adding the ‘optional’ text like so:
>
 The version I have uploaded currently does not include the element
parameter, but if/when we do add it it will definitely be optional.

4.       More information is needed on the sample() method of the
> FrameRequestCallback interface. A non-normative example use case would be
> appropriate.
>
> I'm not sure quite what you mean - FrameRequestCallback should be invisible
to the users of the API and exists mostly as a way to talk about the
enqueued callbacks within the specification.  Users will just pass in a
function to requestAnimationFrame.  Is there a better way to spec this,
Cameron?


> 5.       The Introduction section should have an example use case of this
> API. This can be the canonical example of replacing existing use of
> setTimeout() or setInterval() with this API.
>

There's an example in the Introduction section (
http://dvcs.w3.org/hg/webperf/raw-file/02822501c985/specs/AnimationRequestFrame/Overview.html#introduction)
in the light blue box.   A version quite similar to that code is available
at http://webstuff.nfshost.com/anim-timing/example.html.

- James


>
> Thanks,
>
> Jatinder
>
Received on Tuesday, 3 May 2011 03:06:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 May 2011 03:06:11 GMT