bokand / gesture-vt

Gesture-Driven View Transitions
0 stars 0 forks source link

Should a regular VT be allowed on top of gesture VT #7

Closed khushalsagar closed 5 months ago

khushalsagar commented 6 months ago

The idea behind gesture or pre-emptive VT is to allow cancellable transitions, before a navigation is initiated. It's unclear whether we need to allow starting a regular navigation transition after the pre-emptive VT. This is tricky because the pre-emptive VT will end up with a pseudo-DOM which needs to animate to the new state. So any new transition will have to start off with the end state of the pre-emptive VT.

I think a model where the pre-emptive VT ends at the final state of the new Document is better. Then the UA can add any cross-fade if the cached version of the new Document is used for the transition and its visually different from the live new Document.

bokand commented 6 months ago

I think a model where the pre-emptive VT ends at the final state of the new Document is better

Maybe I don't understand what you mean...but doesn't the author control the end state? How can we guarantee that the final state will end at the new document? i.e. are you suggesting we somehow disallow the author from doing something like

::view-transition-new(root) {
  transform: rotateZ(180deg);
}
bokand commented 6 months ago

My idea in #6 was that we could perform a regular navigation transition after the pre-emptive VT but reuse the already captured view-transition-old(root) snapshot as the old snapshot in the navigation transition. The author would have to setup the pseudo styles on the new page to start in the same state as the last frame of the preemptive VT to stitch the animation together.

It's a bit complicated so I'm not sure yet - but I think this would allow the transition in the gif in #6. Alternatively we could have some kind of multi stage VT animation in the preemptive case (i.e. user lets finger go, we delay the back navigation and play a time based animation). That's probably simpler on authors at the cost of delaying the navigation.

khushalsagar commented 5 months ago

I missed seeing #6 earlier. This is a dupe of that issue, let's continue the discussion there.