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

> > Currently, any animation has an initial value of `animation-trigger: once auto`, so it has a trigger, and calling `cancel()` on that animation should still set its `currentTime` to unresolved, so that animation's effect will be removed.
> > I think that, by itself, should render the associated trigger effectless.
> > Do you think we need to also explicitly disassociate the trigger?
> 
> [@ydaniv](https://github.com/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?
> 

Maybe it makes more sense to have the `currentTime` of a yet-to-trigger animation be unresolved. Then, we can modify the `before phase` definition to account for animation triggers. Something like
"An animation effect is considered to be in its `before phase` if its local time is unresolved and its associated animation has a trigger which:
1. has a non-monotonic timeline, and
2. either is in the `idle` state or is in the `inverse` state and is a `repeat` trigger."

.. better worded perhaps and also doing something similar for a "backwards" direction animation and the `after` phase.

> `cancel()` doesn't set the `currentTime` to unresolved. `currentTime` is a calculated property, you can only affect it by updated the start time and hold time.
> 
> Depending on how an idle trigger interacts with the timing model, `cancel()` may no longer produce the result that the animation no longer affects its target(s).

If we do what I mentioned just above,  we would be introducing a state where you could be in the `before phase` and have an unresolved local time. If we change the [active time calculation](https://drafts.csswg.org/web-animations-1/#calculating-the-active-time) to first check whether local time is unresolved I think that means we can ensure that `cancel` still stops an animation with a trigger from affecting its target?

-- 
GitHub Notification of comment by DavMila
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12064#issuecomment-2807099697 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 18:22:15 UTC