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

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

From: L. David Baron <dbaron@dbaron.org>
Date: Sat, 2 Apr 2011 12:14:46 -0700
To: www-style@w3.org
Message-ID: <20110402191446.GA4199@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. 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
following testcase:

<!DOCTYPE HTML> 
<title>animation test</title> 
<style> 
@-webkit-keyframes bounce {
  from, to { top: 100px }
  50% { top: 0px }
}
p {
  position: relative;
  -webkit-animation: bounce 4s linear infinite;
}
#hover { background: yellow }
#hover:hover p { -webkit-animation-duration: 1s }
</style> 
<div style="height: 100px" id="hover"> 
<p>hello</p> 
</div> 

hovering over the yellow div makes the animation speed up, but
preserves its start time.

It seems relatively easy to handle dynamic changes here -- though
perhaps the main use case for doing so is to avoid having authors
get confused if they do things in the wrong order while setting up
an animation, or accidentally flush before it's all set up properly.

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?

(Was there a reason WebKit's behavior differs from the spec here?)

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Saturday, 2 April 2011 19:15:17 GMT

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