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

Ah, I see a problem with my proposal: `cancel()` stops an animation’s effect from being in effect by setting `startTime` to unresolved. This means `currentTime` is unresolved and so the effect’s `local time` is unresolved and the effect is not **in effect**. If yet-to-trigger animations also have an unresolved `currentTime`, their effect cannot be in effect prior to triggering, regardless of fill-mode, even without `cancel()`. So we have a conflict in interpreting an unresolved local time: not in effect because `cancel()` was called, or still being in effect because fill-mode allows and we are yet to trigger?

Perhaps we can:

1. Define an **_awaiting trigger update_** algorithm for an animation _animation_ as:

```
If animation’s trigger has a monotonic timeline: return false.

If animation’s trigger is in the`idle` state, return true.

If animation’s trigger is a repeat trigger in the `inverse` state, return true.

Return false.
```

2. Have the animation’s `currentTime` be the [before-active boundary time](https://drafts.csswg.org/web-animations-1/#before-active-boundary-time) of its effect (or the [active-after boundary time](https://drafts.csswg.org/web-animations-1/#active-after-boundary-time)  in the case of a “backwards” animation).

3. Update the definition of “[in the before phase](https://drafts.csswg.org/web-animations-1/#animation-effect-before-phase)” to include:

```
…, or
the animation direction is “forwards” and running the awaiting trigger update algorithm on its associated animation returns true.

```
(Similar update for "[in the after phase](https://drafts.csswg.org/web-animations-1/#animation-effect-after-phase)")

This way, `cancel()`, by making the effect’s local time unresolved, still stops the animation from being in effect regardless of  the trigger. And, when `cancel()` has not been called and an animation has not been triggered, a forwards direction animation’s effect will be considered to be in its `before phase` and if it [has fill-mode: both/backwards](https://drafts.csswg.org/web-animations-1/#:~:text=If%20the%20fill%20mode%20is%20backwards%20or%20both), it’ll have an active time and be in effect, otherwise it won’t.


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


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

Received on Wednesday, 16 April 2025 15:09:55 UTC