Skip to content

[web-animations-2] Should ‘state’ triggers cancel() their animation(s) outside the exit range if the animation finished? #11915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DavMila opened this issue Mar 11, 2025 · 2 comments

Comments

@DavMila
Copy link
Contributor

DavMila commented Mar 11, 2025

state animation triggers play or resume their related animation when within their trigger range and pause them when outside their exit range. If, after being played, the animation finishes prior to the trigger’s exit condition being met (being outside the exit range), should state triggers reset the animation when the exit condition is met?

Resetting the animation allows the trigger to naturally restart the animation the next time its trigger condition is met, making it a special case of a repeat trigger.

Not resetting the animation means after it finishes, subsequently meeting the trigger condition won’t replay the animation, making it a special case of a once trigger.

I propose not resetting the animation after it finishes. If an author would like a state trigger to restart after “finishing” they can specify animation-iteration-count: infinite.
OTOH, if we specify that the exit condition resets a finished animation, and the author does not want the animation to restart, they can simply nuke the trigger, i.e. animation.trigger = null.. Though this feels less clean IMO.

@ydaniv
Copy link
Contributor

ydaniv commented Mar 13, 2025

I agree state triggers should not reset animations on exit. Their main use case is specifically pause/resume of animations with infinite iteration count.
I think ideally this type should just pause/resume and rest of the playback behavior should be according to the animation's options.
A use case for resetting could be animations with a long duration but a finite number of iterations, though this is somewhat contrived.

@ydaniv
Copy link
Contributor

ydaniv commented Mar 27, 2025

@DavMila do you think we need to add anything explicit to the spec? Or close as no change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants