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

I was thinking that something like this is probably the best solution.
 (I've had some nightmarish experiences with z-order, so I'm all for
avoiding that as a paradigm.)

Out of curiosity, do we even need the notion of sequence numbers? Or can
animations be regarded as belonging to a list or array structure that can
be enumerated and manipulated with familiar push/pop/insert/append APIs?
(Apologies if this has been discussed before.)

- Kris

On Wed, Jul 15, 2015 at 10:49 PM, Brian Birtles <bbirtles@mozilla.com>
wrote:

> 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 07:50:40 UTC