01 / 13 ยท Web Animations API
Fade
The old page fades away, then the new one fades in. The safest default.
The old page leaves, then the new page enters.
// out-in: the old page fades away on its own, then the new page fades in.
// Chasse takes whatever you return. Here that is plain Web Animations, with no library.
export const fade: TransitionHooks = {
mode: 'out-in',
leave: ({ current }) => current.animate({ opacity: [1, 0] }, { duration: 300, easing: 'ease-in', fill: 'forwards' }),
enter: ({ next }) => next.animate({ opacity: [0, 1] }, { duration: 450, easing: 'ease-out' }),
}