W3C home > Mailing lists > Public > www-style@w3.org > January 2012

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

From: Sylvain Galineau <sylvaing@microsoft.com>
Date: Tue, 24 Jan 2012 04:13:04 +0000
To: Jon Rimmer <jon.rimmer@gmail.com>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <3C4041FF83E1E04A986B6DC50F0178290341B202@TK5EX14MBXC295.redmond.corp.microsoft.com>

[Jon Rimmer:]
> 
> On 20 January 2012 00:01, 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?
> > - 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.
> >
> > Thoughts?
> >
> > [1] http://lists.w3.org/Archives/Public/www-style/2012Jan/0099.html
> >
> >
> 
> Why shouldn't we transition to and from moving targets?
> 
> For both animations and transitions, at any instant, we have a base
> property value, a target property value, and an interpolation function
> that produces an intermediate value based on the duration and the easing.
> All we need is a simple pipeline, where the instantaneous, intermediate
> value from the animation is fed as the base value into the interpolation
> function of the transition.
> 
> Here's a quick demonstration using jQuery:
> http://jsfiddle.net/amtiskaw/rpMzn/4/
> 

First, what are the use-cases that would make this useful? How do authors get 
concurrent inter-dependent animations tuned to produce the desired result? Are 
there desirable effects that can't be otherwise achieved? (It could be that color 
is not the right scenario to demonstrate the usefulness of this). The technical
possibility of it does not concern me as much as its usability and usefulness (yet).

Second, your script assumes that what happens when :hover matches is:
foreach-transition-step(
	1. Compute color as if :hover didn't match
	2. Then use output of #1 to figure out current transition step state based on duration+timing-function
}

I'm not sure where we get #1 from; it's as if color keeps two computed values all along. Never mind that we 
Currently specify that declarative animations do not trigger transitions...but they can change their start 
value? And recall that there is no hard definition of when browsers compute values.

It's certainly easy to express in an imperative manner. Achieving an interoperable result in a declarative
manner is a different problem. But first we should answer what this is for and then discuss how...
Received on Tuesday, 24 January 2012 04:13:41 GMT

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