Re: [csswg-drafts] [css-animations-2][web-animations-2] How should AnimationTrigger work? (#12119)

I've gone through the AnimationTrigger doc and with the help of some explanations from @DavMila I think it makes sense. However, I'm pretty sure I'm still missing some important understanding of how triggers work.

I wonder if anyone would be kind enough to explain to me what wouldn't work in the following very simplistic adaptation of the proposal:

- We introduce means of temporarily overriding the interval endpoint behavior to Web Animations. We already need this in #11881 so perhaps in a similar vein we allow a flag to be passed in to the pause procedure (at a spec level, not the API level) that allows overriding the endpoint behavior whilst paused. (Could scroll animations use something like this too?)
- `AnimationTrigger`s keep track of which animations they are controlling and call `play` / `pause` etc. on them.
- An animation can be controlled by multiple triggers and, provided they have a well-defined evaluation order, the result is just whatever you'd get from calling play / pause / etc. on them in that order.
- Animation's have no notion of whether they are being controlled by a trigger or not but they retain a list of triggers associated with them purely for convenience so that you can navigate from a `CSSAnimation` to any trigger targeting it. (Although even that might not be necessary? If the only use case is disassociating triggers then we could just let `cancel()` do that?)
- Triggers are armed when they are constructed and there is no default trigger.
- `cancel()` disassociates any triggers from the animation.

Sorry for the delay and for where I've surely overlooked important behaviors. I'm just trying to wrap my head around this and see if there's a simpler, less-coupled approach that lets us avoid adding more boolean state parameters to the already-complicated Web Animations model.

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


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

Received on Tuesday, 27 May 2025 06:28:01 UTC