Re: [csswg-drafts] [web-animations-2] Should there be events on target elements to detect started web animations? (#9011)

Thanks for mentioning me. My main concern, as always, is "how does it work with groups?".

I guess we'd dispatch start/end events any time a leaf `KeyframeEffect` went to/from the active phase? Similarly, any time an active-phase `KeyframeEffect` changed target element? (Would we dispatch a `cancel` event on the old target element?)

For iteration events, a group effect can iterate without having a target element so we wouldn't dispatch anything in that case. As a result, if we exposed iteration events at all, there would be a difference in the events reported when the parent group iterates (no iteration events) vs when the child iterates.

If we were to introduce `*run` events, they would likely dispatch every time a parent iterates. I wonder if that makes sense.

So I think it's do-able but there might be a few oddities to think through.

At a more high-level, I wonder if exposing events about _effects_ is a good idea or not. The API currently focuses on _animations_ as the main unit we return (specifically the `getAnimations()` functions). Should we try to stick to reporting about _animations_?

One downside of reporting on _effects_ is that they're less useful for grasping timing relationships, especially in the context of groups, but maybe there are use cases where that's fine?

Another idea is an animation observer interface. Internally the Firefox DevTools uses an animation observer API modelled on the `MutationObserver` API that reports each time an animation is added/removed regardless of whether it is active or not. I imagine Chrome uses something similar? Depending on the use cases, it might be more useful to standardize something like that instead, or as well?

-- 
GitHub Notification of comment by birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9011#issuecomment-1610616768 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 28 June 2023 03:12:29 UTC