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

On Fri, Jul 3, 2015 at 12:21 PM Brian Birtles <bbirtles@mozilla.com> wrote:

> On 2015/07/02 15:10, Shane Stephens wrote:
> >     I guess either you're suggesting:
> >
> >     a) Updating animation properties triggers a global sequence number
> >          rewrite (I hope this isn't the case), or
> >
> >     b) Script-animations and CSS animations share the same source of
> >          sequence numbers but when we come to prioritize animations we
> >          don't use them for prioritizing CSS animations (or at least we
> >          *first* sort by script vs CSS, then by document order, then
> >          finally by animation-name order which happens to match sequence
> >          number order).
> >
> >     I'm pretty sure you're suggesting (b) but I want to be sure.
> >
> >
> > Yup. What I had expressed it as was:
> > "CSS animations use sequence number as priority, and are created in
> > tree- and list- order. CSS Animations are still prioritized absolutely
> > above script animations (there are two lists). "
>
> I think script animations should trump CSS animations.
>
> 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.

Cheers,
    -Shane


> Best regards,
>
> Brian
>

Received on Wednesday, 8 July 2015 21:51:20 UTC