Re: [csswg-drafts] [web-animations-2][css-animations-2] How do AnimationTriggers attach to animations? (#12397)

I'm not unhappy with AnimationTrigger.animations.add/remove syntactically as well but I do worry about this: if we designate `AnimationTrigger.animations` as some generic data structure, e.g. Set, Array, etc, how do we specify the semantics of adding/removing that are specific to AnimationTrigger? I.e. Adding an idle animation to a trigger should pause the animation.

If there isn't a way to do this, would we need some custom `AnimationList` type like `DOMTokenList` of Element.classList? I think introducing a data structure like `DOMTokenList`, whose operations affect the element/object supplying the list, would be introducing more complexity than we need. 

It would be simpler to adopt `AnimationTrigger.addAnimation`/`removeAnimation` and perhaps a `getAnimations` which returns a `Set` of `Animation`s similar to `Element.getAnimations` returning an Array of `Animation`s.

As we had begun to discuss this at the tail end of the working group meeting 2 weeks ago but but ran out of time, I'll add this to the agenda:

Should the method to attach/detach animations to triggers be `AnimationTrigger.addAnimation`/`AnimationTrigger.removeAnimation` or `AnimationTrigger.animations.add`/`AnimationTrigger.animations.remove`? 

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


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

Received on Monday, 30 June 2025 15:08:29 UTC