[web-animations] NaN vs null to represent unresolved / invalid times

Hi,

Currently Web Animations uses null to represent time values that are 
somehow invalid or unresolved.

For example, if an animation is not attached to a player, its local time 
will be null to indicate that it's not playing and nor does it have any 
intention of doing so.

Likewise, an animation timeline that is not yet ready to play can return 
null for its current time to distinguish between a timeline that has 
just begun and one that is somehow inactive.

However, this can be problematic if application code has, e.g.

   var timeRemaining =
      animation.computedTiming.activeDuration -
      animation.computedTiming.localTime;

since localTime, if null, will be treated as 0 giving the wrong result 
(particularly when startTime != 0).

I'm thinking, therefore, that we should use NaN across the board to 
represent unresolved/invalid times.

So
      readonly double? localTime
becomes
      readonly unrestricted double localTime

It probably makes sense to update the timing model description to refer 
to generic "unresolved" values (SMIL does this, by coincidence) and 
convert them to NaN at the interface.

Any thoughts?

Brian

Received on Wednesday, 9 July 2014 00:58:42 UTC