W3C home > Mailing lists > Public > www-style@w3.org > November 2011

Re: [css3-animations] dynamic changes to animation properties or keyframes

From: L. David Baron <dbaron@dbaron.org>
Date: Sun, 6 Nov 2011 11:48:53 -0800
To: www-style@w3.org
Message-ID: <20111106194853.GA25584@pickering.dbaron.org>
On Saturday 2011-04-02 12:14 -0700, L. David Baron wrote:
> http://dev.w3.org/csswg/css3-animations/#animations says:
>   # The values used for the keyframes and animation properties are
>   # snapshotted at the time the animation starts. Changing them
>   # during the execution of the animation has no effect. Note also,
>   # that changing the value of ‘animation-name’ does not necessarily
>   # restart an animation (e.g. if a list of animations are applied
>   # and one is removed from the list, only that animation will stop;
>   # The other animations will continue). In order to restart an
>   # animation, it must be removed then reapplied.
> 
> This doesn't appear to match WebKit's behavior.  For example, in the
[...]
> Should the spec say instead that dynamic changes are honored, but
> the animation start time (as adjusted by pause duration) is
> preserved for each animation name?

I'd note that if the spec does take this approach, it needs to
describe what happens when an animation-name occurs more than once
in the list of animations:  in that case, I believe the start time
for a given animation-name should always track the
animation-play-state value of the last occurrence of that
animation-name in the list of animations.

This is what I implemented in Gecko.

I think this behavior is preferable since in most cases the last
occurrence overrrides earlier ones, which means it's the most likely
of any simple rule to reflect the current state.  (This isn't true
for some values of animation-fill-mode if some of the animations
have completed (or not started yet) and some have not (e.g., because
they have different durations).  It also might not be true if we
allow a property to apply for only a part of animation (though Gecko
currently does not, as I described in [1]).

I'd note that this means that authors will get weird behavior if
they use multiple occurences of the same animation on the same
element *and* dynamically change the animations list on that
element.  But I think that's probably a cost worth paying to have
otherwise-sensible behavior when changing the animations list on an
element.

-David

[1] http://lists.w3.org/Archives/Public/www-style/2011Apr/0645.html

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Sunday, 6 November 2011 19:51:39 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:46 GMT