Re: [css-animations] animation-iteration-count: infinite and animation-duration: 0s

On Fri, Sep 5, 2014 at 2:23 AM, L. David Baron <dbaron@dbaron.org> wrote:
> On Thursday 2014-09-04 11:27 +0900, Brian Birtles wrote:
>>   animation-duration: 0s;
>>   animation-iteration-count: infinite;
>>   animation-fill-mode: both;
>
>>   a) let active duration = 0 -> final key frame value is shown,
>> start/end events are dispatched
>
> I think I actually prefer (a).  It seems like this is an error case,
> and the easiest way to handle the error would be by producing the
> result you'd get if animation-iteration-count were anything other
> than infinite.

Agreed.  Per the principles at
<http://wiki.csswg.org/spec/limited-ranges>, one good approach is to
let the behavior at the problem point be the limit behavior as you
approach that point, if the limit behavior is stable.

In this case, we have two ways we could apply that, holding either one
steady while the other one approaches the troublesome value as a
limit.

: Hold duration at 0, let iteration-count approach infinity
:: behavior is stable, with a zero active duration
: Hold iteration-count at infinity, let duration approach zero
:: behavior is divergent; active duration is stably infinity, but the
value at any point in the timeline is unstable, as it depends deeply
on the precise duration value.

So the only sane limit behavior is (a), replacing the behavior at
infinite iteration-count with the limit behavior of a finite
iteration-count approaching infinity.

>>   b) let active duration = infinity -> initial key frame value is
>> shown, start event only is dispatched
>
> This doesn't make particular sense to me.

Agreed.  This is similar to the second limit behavior (iteration-count
held at infinity, duration approaching 0), but diverges from the
actual behavior is a seemingly arbitrary way; it has no relation to
the behavior of a near-zero duration.

>>   c) it's invalid -> nothing is shown, no events are dispatched
>
> This would be ok.  Not sure whether it feels consistent with the
> rest of the model, though.

This would also be acceptable, per the principles cited above
(technique 3 "define a different behavior entirely for the boundary"),
but it's specifically noted as something you should avoid if possible,
as it exposes rounding behavior.

~TJ

Received on Friday, 5 September 2014 18:26:24 UTC