The animations works well, but now, page:loaded event is triggered before render. Which prevent all my scripts initialized in page:loaded event to work.
Shouldn’t page:loaded be trigger at the end, once the page is rendered ? If this is the expected behavior, how can I make my script initialize correctly ?
Also consider using hot controls, they could help with this. Each transition style could be container within a hot control and the connect() logic can be used for the in animation and the disconnect() logic can be used for the out animation:
I tried the before-visite event for the out animation, but I’m not sure how to use it correctly. Tried this :
addEventListener('page:before-visit', async (e) => {
e.preventDefault();
console.log('before-visit');
await gsap.to("#header", {x: 100, duration: 1});
//e.detail.resume(); // Method does not exists for page:before visit method
oc.visit(e.detail.url); // So tried this, but I'm in an infinite loop as it will trigger before-visit event again
});