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

On Mon, Jun 22, 2015 at 4:57 PM, Shane Stephens <shans@google.com> wrote:
> An alternative proposal:
> 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). Changing an animation-name property
> triggers an update of all listed sequence numbers. So:
>
>    elem.style.animation = 'a 2s, b 3s, c 4s'; // a: 0, b: 1, c: 2
>    let b = elem.getAnimations[1];
>    let c = elem.getAnimations[2];
>    elem.style.animation = 'a 2s, d 5s'; //a: 3, d: 4
>    c.play(); // c promoted to script animation, keeps sequence number
>    b.play(); // b promoted to script animation, keeps sequence number
>    elem.getAnimations(); // what is the order here? b,c,a,d

Yes, this makes sense to me.  It was the confusing behavior of
*previous* animation property definitions affecting the ordering of
*current* animations that was weird; with that out of the way (so it's
only the latest), it's fine to me.

> Taking your weirdness:
>
>    var moveLeft = new Animation(...);
>    var moveRight = new Animation(...);
>    moveRight.play();
>    ...
>    moveLeft.play();
>    // Wait, why doesn't moveLeft take effect?
>
> Let's extend it another step, assuming that transitioning from idle does
> update priority:
>
>    var moveLeft = new Animation(...);
>    var moveRight = new Animation(...);
>    moveRight.play();
>    ...
>    moveLeft.play(); // moveLeft takes effect
>    moveRight.play(); // wait, why doesn't moveRight take effect?
>
> So you haven't solved anything, just pushed the weirdness down a level so
> that it bites harder.

Yup, good point. I agree now that moving to play-order doesn't help
here, and sticking to creation order is fine.

~TJ

Received on Tuesday, 23 June 2015 00:08:47 UTC