W3C home > Mailing lists > Public > public-web-perf@w3.org > February 2012

Re: Specifying window.performance.now()

From: James Robinson <jamesr@google.com>
Date: Wed, 29 Feb 2012 13:52:10 -0800
Message-ID: <CAD73mdL4Of=rDeCVoY4avoP-vt6Q8Tj6X6zQDCPUK0+aafsaUQ@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: public-web-perf@w3.org
On Wed, Feb 29, 2012 at 1:40 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 2/29/12 4:20 PM, James Robinson wrote:
>
>> I'm a little more optimistic about requestAnimationFrame.  It's true
>> that lots of code is using JS Date.now(), but that code will continue to
>> work as-is.  I do not think that there is a large amount of web content
>> out there using the callback _parameter_ for timing, most code is just
>> ignoring it and grabbing the time out-of-band.
>>
>
> If true, that would make things work ok.  I guess I'd thought people would
> actually use the parameter, since it's there for a reason...
>
> Certainly the demos I've seen using requestAnimationFrame use it.  I seem
> to recall Google Maps doing so too, but maybe they changed that?


Technically speaking using the parameter to track animation progress is OK,
so long as the page isn't trying to compare the parameter to JS Date.now()s.

My reading of the code that Google Maps is using for animations today is
that it's always using the value of Date.now() to update its internal
progress.  I could be wrong since I'm only reading the code and not testing
it, but I believe that we're OK for that site in particular (and anything
else using this particular bit of common Google JS infrastructure for
animations).

- James


>
>
>  I think we should try changing this and see what happens.  If it turns
>> out that we can't change the value of the first parameter to the
>> callback, then we can do something uglier like provide a second callback
>> parameter.
>>
>
> :(
>
>
>  I think that we definitely do want to provide a timestamp to
>> authors as a callback parameter so that they can synchronize multiple
>> animations running on the same logical frame.
>>
>
> Oh, we absolutely do.  That's what Gecko does right now.  The only
> question is what the timestamp's 0-point should be....
>
> -Boris
>
>
Received on Wednesday, 29 February 2012 21:52:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 29 February 2012 21:52:39 GMT