RE: [css3-animations] Override of animation rule by !important


[Øyvind Stenhaug:]
> 
> On Fri, 20 Jan 2012 01:01:51 +0100, Sylvain Galineau
> <sylvaing@microsoft.com> wrote:
> 
> > We resolved during the 1/4 telcon [1] to allow !important user rules
> > to override animations.
> >
> > While this seems reasonable and coherent with the overall CSS model,
> > we need to understand what it means in scenarios such as:
> >
> >  @keyframes colorChange {
> >        from { color: red; }
> >             to { color: blue; }
> >  }
> >  div {
> >   animation: colorChange 4s infinite alternate;
> >   transition: color 1s;
> >  }
> >
> > /* user stylesheet */
> > div:hover { color: green !important; }
> >
> >
> > Obviously the fun part is when the :hover rule matches during the
> > animation.
> >
> > - Does the :hover transition starts from whatever intermediate value
> > was last applied by colorChange?
> 
> I'm not sure, but presumably it should act the same as if the animation
> were removed while in progress. If there is a transition, it should
> probably start from the intermediate value. But maybe there shouldn't be a
> transition at all.
> 
> > - What happens when the user hovers away? Transitioning back to a
> > moving target is not easy nor is it clearly desirable. Nor would a
> > reversal look appropriate.
> 
> The current Transitions draft says that "[i]mplementations must not start
> a transition when the computed value of a property changes as a result of
> declarative animation". This seems like such a case, though I think that
> sentence could use some clarification. (If the property's "computed value"
> changes due to an animation finishing or being aborted, like in the
> previous question, does that count as a "result of declarative
> animation"?)

Well in this case the transition is started by a property update through 
:hover, not the animation. But the latter has been updating the computed
value of color so, presumably, the state of the property at :hover time
is our transition start? 

Once :hover no longer matches, we can't really reverse to the start value
if the latter should resume its animation. I can't think of a good solution 
that does not involve stopping the animation as soon as the transition starts.

> 
> See also <http://lists.w3.org/Archives/Public/www-style/2011Nov/0071.html>.

That was a good post. Bug #15242 in Bugzilla.
> 
> > [1] http://lists.w3.org/Archives/Public/www-style/2012Jan/0099.html

> 
> 
> --
> Øyvind Stenhaug
> Core Norway, Opera Software ASA

Received on Friday, 20 January 2012 16:14:56 UTC