Demo: https://stackblitz.com/edit/nextjs-atnnzx?file=pages%2Findex.js
Hello,
I am working in React/Nextjs trying to create a component consisting of multiple scenes and tab-like buttons to switch between them. The components in each scene have in and out animations using opacity to create smooth fade transitions between each scene change. Due to the animations being triggered by user input it is highly likely they will be interrupted, so to help keep things smooth I've used.to on the out animations with the intention they animate out from whatever state they were before animating in the next scene.
I'll skip over my current understanding of why it currently isn't working as I'd hoped but at the moment when you click between the buttons and the active scene index changes,ctx.revert()gets called and the out animation animates out from a reset state so it's not smooth unless the in animation has completed. I've bashed my head against this for hours, I cannot work out how to approach this.
revert()needs to get called because otherwise I run into.from logic issues but I'm not sure at which place to call it. I've tried moving ctx.revert()to get called at the end of a timeline but that causes all sorts of confusion - I've a feeling I need multiple timelines and alternate between them during scene switches but am not sure how to implement and the stress of a deadline is causing my tiny brain to tighten up to the point I cannot think creatively.
I've created a minimal demo here with 3 scenes, and would really appreciate some help from the community: https://stackblitz.com/edit/nextjs-atnnzx?file=pages%2Findex.js
Here for any questions if I've not communicated my issue properly.
Thanks
Roo