A view transition is removed when all constituent animations are no longer running or paused. However, the spec only defines this for document timelines:
- Let hasActiveAnimations be a boolean, initially false.
- For each element of transition’s transition root pseudo-element's inclusive descendants:
- For each animation whose timeline is a document timeline associated with document, and contains at least one associated effect whose effect target is element, set hasActiveAnimations to true if any of the following conditions is true:
- animation’s play state is paused or running.
- document’s pending animation event queue has any events associated with animation.
We should at least define what happens for other kinds of timelines.
However, as @bramus found it might be more useful to keep a view transition alive while it has a scroll timeline regardless of its current state, since it can be reversed by the user (unlike a document timeline). If we do that, I think authors can finish the view transition manually by calling cancel() on the transition animations? Perhaps we could make this more convenient via the ViewTransition object?
A view transition is removed when all constituent animations are no longer running or paused. However, the spec only defines this for document timelines:
We should at least define what happens for other kinds of timelines.
However, as @bramus found it might be more useful to keep a view transition alive while it has a scroll timeline regardless of its current state, since it can be reversed by the user (unlike a document timeline). If we do that, I think authors can finish the view transition manually by calling
cancel()on the transition animations? Perhaps we could make this more convenient via theViewTransitionobject?