Currently I have my three-fiber component visible on two pages, where I conditionally display them under gatsby-browser.js, wrap page content. So that when being routed across pages, I dont reload the entire scene. It doesnt take long as its not complex, but is still not good ux.
I am interested in a better way to keep the animation persistent, and load the component on website load, regardless of where I enter the website.
export const wrapPageElement = ({ element, props }) => {
return <Layout {...props}>{element}</Layout>
}
where my Layout component, loads another component that contains the 3d scene (Hero).
const Layout = props => {
return (
<Hero style={shouldDisplayHero? {} : {display: 'none'}}></Hero>
)
}
The display none, shows up abruptly and I am unable to apply css animations, as the some inline css being applied to the canvas div overloads class definitions (especially height)
I am sorry if I am really new and trying to learn, thanks in advance.