Re: [css3-animations] Evenly spaced animation keyframes

On Friday 2011-09-23 03:06 +0300, Lea Verou wrote:
> I was thinking, we could do something similar for animation
> keyframes, by allowing numbers to be specified instead of
> percentages. For example the above animation could become:
> 
> @keyframes rainbow {
>     from, to { background: red }
>     2 { background: yellow }
>     3 { background: green }
>     4 { background: aqua }
>     5 { background: blue }
>     6 { background: fuchsia }
> }

It seems reasonable, but I don't like the idea of mixing the numbers
with 'from' and 'to' (which are defined to be 0% and 100%).  It
seems like you're assuming that the author wanted the same space
between '6' and 'to' as between '5' and '6' -- but it's not clear to
me why that's a good assumption (especially if the other values
aren't evenly spaced).  In other words, I think this would make
sense:

@keyframes rainbow {
    1, 7 { background: red }
    2 { background: yellow }
    3 { background: green }
    4 { background: aqua }
    5 { background: blue }
    6 { background: fuchsia }
}

Do you assume that the lowest number is the start and the highest
number is the end (my preference) -- or should there be anything
special about 0 or 1?


I think it probably doesn't make sense to allow mixing of different
scales (percents / numbers / times) within the same keyframes rule,
especially if times are ever involved.  I think this largely because
keyframes don't cascade (though I wish they did), which means that
changing between times that are the same and times that are very
slightly apart will yield very different results (since it changes
whether one keyframe wipes out the other or not).

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Friday, 23 September 2011 00:29:35 UTC