domchristie / turn

📖 Animate page transitions in Turbo Drive apps
https://domchristie.github.io/turn/
MIT License
167 stars 6 forks source link

Improve support for View Transitions, Restoration animations, and better Examples #6

Closed domchristie closed 1 year ago

domchristie commented 1 year ago

Improved Support for View Transitions

Standard (non-View Transition) CSS animations can be used alongside View Transitions, rather than the factory swithcing between Turn types. When supported and enabled, The flow will be as follows:

  1. Exit animations with standard CSS
  2. Once exit animations have completed, start the View Transition
  3. Once the View Transition has completed, apply the enter animations

The architecture has been altered to make this change work. Turn classes are no longer responsible for tracking whether a render is a preview, a post-preview, or a direct one. This responsibility now lies with the Controller, which translates Turbo events into method calls on Turn instances.

Expanded Class Names + Restoration Animations

On the HTML element:

Better Examples

Examples have been overhauled to better demonstrate various use cases with and without View Transitions