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

[css3-animations] dynamic changes to @keyframes rules

From: L. David Baron <dbaron@dbaron.org>
Date: Mon, 11 Apr 2011 21:27:32 -0700
To: www-style@w3.org
Message-ID: <20110412042732.GA14562@pickering.dbaron.org>
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.
Ignoring dynamic changes seems to me like a bad idea.  It's contrary
to most of the rest of CSS, except where absolutely necessary (as it
is for transitions, because of the way they start).  Furthermore, it
introduces a risk of races -- if an author is dynamically setting up
keyframes and animation properties, accidentally causing a flush at
one point during the setup could cause unexpected changes in
behavior in one browser, or differences between browsers that are
fully allowed by the spec because the timing of style data flushing
is not defined.

I would prefer, and have implemented in Gecko, a model where changes
to keyframes and to animation properties other than
'animation-delay' are dynamic.  For each element or pseudo-element,
each animation-name in the element's animations list has a start
time that is computed from when that animation-name most recently
became part of the element's set of animation names, adjusted by the
animation-delay at that time, and adjusted by the length of any
intervals since during which the animation-play-state was paused.
The animation values are computed from those start times, and
everything else responds to dynamic changes.

(I've also observed that WebKit doesn't do what the spec says either
-- it honors at least changes in animation-duration in the manner
that matches what I've implemented in Gecko; I haven't tested
further than that.)


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Tuesday, 12 April 2011 04:28:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:58 UTC