-
Notifications
You must be signed in to change notification settings - Fork 694
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
[css-view-transitions-2] Starting a transition half way through another transition #8687
Comments
For the user experience it might probably ok to try the best in that case and choose state-B as the 'old' and state-C as the 'new'. Though as the author is expected to provide a Sebastian |
How would that be different in practice to what we're currently doing? |
I just repeated what you suggested by saying "using its DOM state-B as the 'old' and DOM state-C as the 'new'". Sebastian |
This way solves the problem and is also reasonably intuitive:
State A should remain in the pseudo-element tree until its transition is finished, even if the transition has been interrupted with state C. Perhaps setting |
This issue also applies to [css-view-transitions-1], should there be a second label? |
Also the conversation in WICG/view-transitions#157 is relevant here. |
A while back I ran a poll (Twitter, Mastodon) asking authors what is missing from View Transitions. Out of the 33 replies, 6 requested this feature, making it the number 1 request (along with scoped transitions and auto v-t-name generation) Also leaving a note here that many folks call this "interruptible transitions". That term might give the wrong impression though, as some interpret this as being able to stop (and skip forward) a transition. During an internal conversation @tdresser called this "retargetable transitions", which is a term I quite like for this. |
Imagine a list of items that randomly reorders and changes background colours, with each list item having its own
view-transition-name
.Let's say, a reordering happens, then another happens halfway through the previous transition.
By default, the new transition causes the previous transition to skip to the end, and the new transition starts from that point. That gives you a stable start point for the animation, but it doesn't look great visually.
Alternatively, the developer could queue on the previous
transition.finished
. This gives a smoother animation, but a delay to the interaction.Something we don't offer right now is the ability to pick up from where the previous transition was at the point of skipping.
In this simple case we could make it work (via an opt-in) like this:
During the "old" capture phase:
However, things get messy in more complex cases:
If the developer is interrupting a state-A to state-B transition with a transition to state-C, they may now have groups in the transition that wouldn't usually be there in a state-B to state-C transition. For example, if state-A to state-B involves header & footer, and state-B to state-C involves header & sidebar, they now have a combined transition involving header, footer, & sidebar. They'd have to carefully plan for this.
Or a case like this:
view-transition-name
.view-transition-name
.In this case I don't see how we "continue" the animation of the user-avatar, as it's likely embedded in some other group. This is particularly an issue for the
::view-transition-old
from the first transition, since the avatar is somewhere in there as pixels, and we can't extract it.The only sensible thing we could do here is create a transition group for the user-avatar using its DOM state-B as the 'old' and DOM state-C as the 'new'. That might result in the user seeing multiple user-avatars, since a copy of it is already baked into another group.
Maybe there's a better way?
The text was updated successfully, but these errors were encountered: