Re: [csswg-drafts] [web-animations-2][css-animations-2] Should an animation be allowed to have multiple triggers associated? (#12399)

> After reviewing more of [@szager-chromium](https://github.com/szager-chromium)'s PR for adding event-triggers I understand how multiple triggers per animation seem trivial from that point of view. Since `once` can work by simply not allowing animations to rewind, and the other behaviors mostly work because of the event-based stateless nature. However, there's still the bit of state there inside the trigger - the `idle` state of the trigger (I think it was confused with `idle` play-state of the animation). So this is still an issue. But like you said, with the stateful nature timeline-based triggers this becomes messy.
> 
> > Script can enforce this by throwing an error when `AnimationTrigger.addAnimation` (or whatever we settle on in [#12397](https://github.com/w3c/csswg-drafts/issues/12397)) is called on a trigger which already has an animation attached.
> 
> We could also say that adding an animation to a trigger simply detaches it form its current trigger and attaches to the new one.

Realizing what I wrote here was not what I meant to write 🤦‍♂️  . I meant to write that "Script can enforce this by throwing an error when AnimationTrigger.addAnimation is called with an animation which already has a different trigger attached. But thanks for understanding the point despite that.

The reason for throwing an error rather than silently disassociating from the previous trigger is so that it will be less of a breaking change if/when we decide to allow multiple triggers per animation. We expect that authors wouldn't be relying on behavior that throws so when we change the behavior it would only affect cases that weren't possible before.



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


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

Received on Friday, 18 July 2025 14:36:58 UTC