Re: [css3-transitions] API to force a transition to start

On Mar 30, 2011, at 3:06 PM, L. David Baron wrote:

> One thing that I've noticed people wanting to do with transitions is
> to do a transition immediately when they create an element.
> Currently, there are two workarounds for this:
> 
> * Set the "from" style value, do something that forces a style data
>   flush (e.g., calling getComputedStyle), and then set the "to"
>   style value.  The repeated flushing of style can be bad for
>   performance.
> 
> * Use animations, which can be somewhat heavyweight.
> 
> I wonder if it would be useful to add a method like this to
> ElementCSSInlineStyle [1]:
> 
>  // or maybe called transitionAndSetProperty?
>  void transitionStyle(in DOMString property,
>                       in DOMString fromValue,
>                       in DOMString toValue);
> 
>  This method is equivalent to element.style.setProperty(property,
>  toValue, ""), except that it additionally causes the transition of
>  property that would have resulted if element.style.setProperty(
>  property, fromValue, "") had been the previous modification to the
>  element's style.

This doesn't help if the author wants to manage the various states
of their elements with non-inline style, though. If we add API, I think
we should add something that allows authors to run transitions whose
states are described by non-inline style.

Simon

Received on Wednesday, 30 March 2011 22:26:01 UTC