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

> paused.forEach(anim => anim.play());
> I'd expect it to restore the animations to the state they were in prior to pausing. With play arming the trigger, I think this code just works, however if it's a separate API to arm the triggers then developers will have to carefully handle that in some way.

Thanks for bringing this up! This might be the key difference between the models boiling down to a question:

Is it more surprising that after I have set up a trigger, when I explicitly call `play()`, the animation plays even if the trigger condition hasn't been met or that after I have set up a trigger, explicitly calling `play()` doesn't play the animation if the trigger condition hasn't been met?

I'm inclined to think that because `play()` is a very widely used API that is already familiar to authors as immediately playing the animation, the latter is more surprising. I do acknowledge how the external model creates a need, e.g. for dev tools, to incorporate explicit support for triggers.

Also, there might be a bit of a parallel to the relationship between `animation-play-state` and `play()` in that even if you have `animation-play-state: paused`, `play()` ignores that and makes the animation advance. (I'll note that this is only relevant for CSS animations and not WAAPI animations) It would seem to make sense that `play()` and `animation-trigger` have a similar relationship.

Overall, it seems to me like a bit of a severe limitation that an author cannot play an animation because they have set up a trigger whose condition has not yet been met?

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


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

Received on Thursday, 8 May 2025 21:11:40 UTC