View Transitions keep the pseudo DOM state alive until there is an active animation on any of the generated pseudo-elements. This is fine if the author is using CSS or Web Animations, but not if the animation is driven by script using rAF or setTimeout.
We can add an API as follows which allows the author to pass a promise indicating when a custom script driven animation has finished.
function animateHeader(transition) {
transition.waitUntil((async () => {
// animate the header here, and return when done
})());
}
async function startAnimations(transition) {
await transition.ready;
animateHeader(transition);
animateFooter(transition);
animateThumbnail(transition);
}
credits to @jakearchibald for the API suggestion.
View Transitions keep the pseudo DOM state alive until there is an active animation on any of the generated pseudo-elements. This is fine if the author is using CSS or Web Animations, but not if the animation is driven by script using rAF or setTimeout.
We can add an API as follows which allows the author to pass a promise indicating when a custom script driven animation has finished.
credits to @jakearchibald for the API suggestion.