Re: [web-animations] Ordering animations based on when they transition from idle

On 2015/07/09 6:50, Shane Stephens wrote:
> On Fri, Jul 3, 2015 at 12:21 PM Brian Birtles <bbirtles@mozilla.com
> <mailto:bbirtles@mozilla.com>> wrote:
>     Also, I think we need to clarify when these sequence numbers are
>     updated. Presumably changes to tree order prior to disassociating the
>     animations are respected. If so, I think that leaves us with:
>
>     CSS animations that are owned by script (i.e. no longer associated with
>     markup) are prioritized as follows:
>
>     1. Animations are sorted by the moment (style change event) where
>          they were that were disassociated from style.
>     2. Animations that were disassociated from style at the same moment
>          sort by document order of the (pseudo-)element they were associated
>          with at the style change event prior to when they were
>     disassociated.
>     3. Animations that were disassociated from style at the same moment and
>          were associated with the same (pseudo-)element sort by their
>          relative position in the computed value of the animation-name
>          property on that element at the style change event prior to when
>          they were disassociated.
>
>     Does that sound right? (I actually hope not since I'd rather not
>     implement it!)
>
>
> Yes, that sounds right. Although it's complicated, I think it's better
> to take on that complication as implementers rather than cause the
> ordering scheme for script animations to be compromised, which will hurt
> web devs.
>
> However, maybe we can merge the two approaches to create something
> that's overall simpler. What if:
> * style animations become script animations on their first
> script-mediated transition from idle (rather than at the point when
> they're cancelled by the style engine). This is the first point at which
> they can cause visual effect changes while being "owned" by script.
> * we sort only by these transitions from idle - i.e. script-generated
> animations. as well as style animations that have already been played
> once from script, don't re-sort.

Thanks, that definitely seems more implementable.

(And sorry, re-reading my description I notice I completely butchered 
the first step. I trust you worked out what I was *trying* to say.)

I wonder if this proposal is a little bit odd in that we have the 
following two cases:

a) var anim = new CSSAnimation(...);
    anim.play();

b) elem.style.animation = "...";
    var anim = elem.getAnimations()[0];
    elem.style.animation = "";
    anim.play();

In (a), the priority of anim is based on when the ctor is called but in 
(b) the priority of anim is based on when play() is called.

Would it be more consistent to say that the priority of all 
script-generated animations is based on their first transition from 
idle? And for repurposed CSS animations it is their first transition 
from idle after being disowned by CSS?

i.e. for both (a) and (b), it is based on when play() is first called?

Best regards,

Brian

Received on Thursday, 9 July 2015 01:30:34 UTC