[web-animations] Animation composite order (was: Ordering animations based on when they transition from idle)

Hi,

Just following up on this thread, Shane and I discussed this a bit on
IRC yesterday and we wonder if we should push ahead with adding the
ability to tweak priorities soon-ish.

A few points we discussed:

* "Priority" may be confused with CSS prioritization. From here on we
   will refer to "composite order".[1]

* We want to avoid an API like z-index for setting composite order.
   See [2] for some extreme examples of how z-index is abused in the
   wild.

* An API along the lines of ChildNode[3] using reference nodes is
   probably better.

   e.g. animA.compositeAfter(animB);

   Strawman proposal:

   Animation.compositeBefore(refAnim)
     Rewrite sequence numbers so that Animation has the same sequence
     number as refAnim minus 1. No idea what we should do if either
     animation is a CSS animation/transition bound to markup. It might
     throw or we might be able to do something sensible.

   Animation.compositeBefore(null)
     Makes this animation the top of the stack.

   Likewise Animation.compositeAfter (mostly so you can do
   anim.compositeAfter(null) to put it on the *bottom* of the stack.)

   A query method might be needed too, e.g. Animation.isBefore().

With that in mind, I'm ok with using creation-time ordering plus the
quirk we described for repurposed CSS animations/transitions--namely
that their sequence number is reset on their first transition from idle
after being orphaned.

There's still plenty of work to do to try and align all these
definitions but what do you think of this approach?

Best regards,

Brian

[1] https://github.com/w3c/web-animations/issues/100
[2] http://reports.quickleft.com/css
[3] https://dom.spec.whatwg.org/#interface-childnode

Received on Thursday, 16 July 2015 05:49:38 UTC