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

> > Sure, any method should apply its effect, so calling `cancel()` should terminate that animation and any effect it applies.
> 
> But haven't we defined that if a trigger is attached to an animation then it ends up being put in the before phase with a zero time? Meaning that if it has a backwards fill, that will take effect? So in order to remove that does `cancel()` need to disassociate from the trigger?

This seems related to the [issue](https://github.com/w3c/csswg-drafts/issues/11914#issuecomment-2759023804) @ydaniv linked earlier. There, our current proposal is that `animation-trigger` can still `play`, `pause`, etc an animation after it has been `play`ed, `pause`d, etc by a WAAPI. It sounds like you think `cancel` should be different in that the trigger should no longer be able to do those things?


> 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?

If we don't want the trigger to be able to perform those actions on the animation after `cancel()` I think we would need to explicitly disassociate it since, for example, 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 [modify it](https://github.com/w3c/csswg-drafts/pull/12013) to currentTime) 
Otherwise, in the following instance the trigger could still cause the animation to have visual effect:

- user scrolls into default range, causing animation (which has `fill-mode: both`) to play,
- page calls `cancel()` on the animation, stopping the animation from taking visual effect,
- user scrolls outside the exit range, causing the animation to be frozen be reset and at its first keyframe / 0% progress.

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


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

Received on Monday, 14 April 2025 17:31:20 UTC