Re: [csswg-drafts] [css-animations-2][web-animations-2] How should `animation-play-state` interact with `animation-trigger`? (#12064)

> @ydaniv Maybe the problem is I don't understand how [the following behavior](https://drafts.csswg.org/web-animations-2/#animation-trigger-state-idle) is intended to be realised:
> 
> > The [animation effect](https://drafts.csswg.org/web-animations-1/#animation-effect) associated animation remains in its [before phase](https://drafts.csswg.org/web-animations-1/#animation-effect-before-phase) and stays at zero [current time](https://drafts.csswg.org/web-animations-1/#animation-current-time).
>
> What part of the timing model is actually updated here?

Perhaps this part does need a more precise definition.
The intent is that a trigger will prevent playback from starting and that the animation's effect will still produce output according to its `fill-mode` value.
Since we can't prevent the `animationstart` event from triggering, I wonder if it even makes any sense to keep the "in before phase" part?

Maybe it would have made more sense to set `hold time` to 0, but then [playing an animation](https://drafts.csswg.org/web-animations-1/#playing-an-animation-section) already does that.
So perhaps it's best that we _don't_ specify anything here that may contradict with the model, and instead introduce a new flag, like `hold playback` (similar to how auto-rewind` works around it for a specific use-case). This can be initially `false`, and the trigger needs only to set it to `true` when [setting a trigger of an animation](https://drafts.csswg.org/web-animations-2/#setting-animation-trigger).

Then upon `cancel()` we could simply specify disassociating the trigger from the animation + setting `hold playback` to `false`. And the rest can stay as is.

---------------

> a repeat trigger can [set the currentTime](https://drafts.csswg.org/web-animations-2/#:~:text=resetting%20the%20associated%20animation%20effect) of the animation? (that link says "start time" currently but we intend to https://github.com/w3c/csswg-drafts/pull/12013 to currentTime)

Ooh, yes, we need to change that as well.
I think more accurate would be to say that it should seek the animation back to `hold time` of 0.

@birtles does the above suggestion work better for you?

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


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

Received on Tuesday, 15 April 2025 14:24:37 UTC