03 / 13 ยท Web Animations API
Cover
The new page rises over the old one first. The old page leaves after.
The new page enters over the old one, then the old page leaves.
// in-out: the new page rises over the old one first, then the old page fades away underneath.
export const cover: TransitionHooks = {
mode: 'in-out',
enter: ({ next }) =>
next.animate(
{ transform: ['translateY(100vh)', 'none'], borderRadius: ['28px 28px 0 0', '0px'] },
{ duration: 800, easing: 'cubic-bezier(0.16, 1, 0.3, 1)' },
),
leave: ({ current }) => current.animate({ opacity: [1, 0] }, { duration: 200, fill: 'forwards' }),
}