Further Customization
Only run when exiting or entering the stage.
::view-transition-old(replace-effect):only-child {
animation: var(--animation-scale-down);
}
::view-transition-new(replace-effect):only-child {
animation: var(--animation-slide-in-up);
}
Now we morph if the element is shared across views, but animate out or in if it's disconnected.
See a demo