RE: Units of time in Web Animations [was: Intent to Ship: Element.animate]

Also of note: at the recent W3C TAG face-to-face, we did a review of the web animations spec and highlighted this use of seconds in a JavaScript API as a design issue that would need rectifying. We will be incorporating the milliseconds preference guideline into our design principles document, which is not yet drafted as a TAG Recommendation, but will be in the near future. That is tracked here:

https://github.com/w3ctag/design-principles/issues/6

We would recommend using milliseconds for this JavaScript API.
________________________________
From: Brian Birtles<mailto:bbirtles@mozilla.com>
Sent: ý2014-ý04-ý16 20:42
To: Michael Mullany<mailto:michael@sencha.com>; Tab Atkins Jr.<mailto:jackalmage@gmail.com>
Cc: Domenic Denicola<mailto:domenic@domenicdenicola.com>; Shane Stephens<mailto:shans@google.com>; Douglas Stockwell<mailto:dstockwell@google.com>; public-fx@w3.org<mailto:public-fx@w3.org>; Rik Cabanier<mailto:cabanier@gmail.com>; Paul Irish<mailto:paulirish@google.com>
Subject: Re: Units of time in Web Animations [was: Intent to Ship: Element.animate]

(2014/04/17 8:39), Michael Mullany wrote:
> Tab,
>
> I think this is a JavaScript / CSS cultural divide. I have rarely seen
> ms used in CSS questions on StackOverflow or in almost any Codepen
> example. On the other hand, I think JavaScript folks think in ms.

I think you're right. Paul's survey and GitHub search seem to confirm
this pattern.

My inclination at the moment is to make raw numbers in Web Animations
represent ms.

I thought we could possibly make the TimingInput dictionary's 'duration'
member be a union type "(DOMString or double)" but they're not
distinguishable right?

Suppose we find a way to allow "2s", "2000ms" or 2000 (=milliseconds)
for "duration", we'd have to apply the same treatment to "delay",
"endDelay", and "iterationStart". And we'd have to also do the same for
the Timing interface later and define behavior so that when setting
animation.timing.duration = "2s" we automatically convert it to 2000 (so
that whenever you *read* animation.timing.duration you get the same
thing and didn't have to test its type). And then there's
AnimationPlayer too. It's possible, but it seems preferable if we can
just settle on seconds or milliseconds.

I'm not sure how to resolve this but I think Shane has some ideas for
polling.

> I personally doubt that many CSS folks will adopt Web Animations (it has
> always seemed to me a very complicated spec to understand), so perhaps
> ms makes sense for the audience that will use it.

It's a massive spec. I think we'll end up carving out a subset as level
1. It would help if we can get tool support to achieve this.

Best regards,

Brian

Received on Thursday, 17 April 2014 01:07:10 UTC