[web-animations] Can AnimationNode expose finished like promises in AnimationPlayer?

(This is a repost of https://lists.w3.org/Archives/Public/public-fx/2015JanMar/0038.html <https://lists.w3.org/Archives/Public/public-fx/2015JanMar/0038.html>, with title now correctly prefixed with the topic and some minor adjustment to the content. Hope it won’t be treated as a spam. :)

If I understand the spec correctly, currently, only when a whole sequence of animation nodes are finished, will authors be notified, through the finished promise exposed by the player. However, it’s impossible to get notified when each individual animation node inside that sequence is finished animating. Since animation nodes have the knowledge of its staring and ending time, I wonder if it makes sense expose these time points? For example, start (fired at 0 local time), end (fired and end of the active interval) and also iterationStart (fired at start of each iteration), iterationEnd ((fired at end of each iteration). Ideally, these events should bubble to the player, but not sure how that could be done if only promises are used.

The use case is that I want to manipulate the class name of each animation node’s element after they done animating. For example, an element is slowly moved to the middle of the viewport by manipulating its transform property (by dynamically calculating viewport's dimension and element’s dimension), but once it’s done moving, I want to change the element's class name so it actually use flex layout to stay in the middle, to eliminate the space occupied by its original box (in turn to eliminate the scroll bar for example), which basically use class names to implement forwards fill mode.

Is this the right thing to do? If so, would it be possible for animation nodes to expose their time points?

Received on Sunday, 8 February 2015 03:54:10 UTC