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

> > If we consider event-based triggers, though they aren't fully specified yet we can think of use-cases like:
> > 
> > * 2 `click` triggers of type `once` on different elements working on same animation. If the trigger contains the state, does each apply a `once` effect? Otherwise, if we expect for this animation to play once, this state should be part of the animation. Since the notion of "once" is part of the trigger, not the animation, this starts complicating the model.
> > * Same example above with `state` or `alternate`.
> 
> Hm, I don't think it's complicated: the once notion is part of the trigger, not the animation. Two clicks (on the separate trigger click targets) will play the animation twice, so long as the second click happens after the animation finishes from the first click. If the second occurs while the animation is playing from the first, it's essentially a noop, just like invoking `play()` is. Right [@szager-chromium](https://github.com/szager-chromium) ?

I agree with this interpretation.

@DavMila -- Unlike timeline-based triggers, event-based triggers are stateless, so the question of "where the state lives" is moot. There shouldn't be anything messy about multiple triggers affecting a single animation.

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


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

Received on Thursday, 10 July 2025 21:36:31 UTC