You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where <Content /> is a component using react-gsap targets.set to set targets similarly to what is done in the examples.
I want to control my timeline playState using useState inside my <Component /> which contains the <Timeline />.
But every time I change state <Content /> is re-rendered of course. The thing is my playState depends depends on <Content /> (I wait for some elements inside <Content /> to load, then I inform <Component /> that animation can begin and setPlayState(PlayState.play). Because of the re-rendering it is not possible because <Content /> stuff are reloaded, the animation begins before it has fully loaded.
I don't think this is currently possible due how react-gsap is structured because content is a rendered prop of <Timeline />. I understand this was done this way in order to be able to set the targets but IMO we should be able to separate content and animation in the React tree.
I tried to make it clear and I hope I am not doing anything too weird.
The text was updated successfully, but these errors were encountered:
I ended up not using playState but using low-level GSAP to control timeline play state from content.
In order to do that I had to pass the <Timeline /> ref to <Content />. because of issue #33 I had to use a wrapper component.
I have defined my timeline as such:
where
<Content />
is a component using react-gsaptargets.set
to set targets similarly to what is done in the examples.I want to control my timeline
playState
usinguseState
inside my<Component />
which contains the<Timeline />
.But every time I change state
<Content />
is re-rendered of course. The thing is myplayState
depends depends on<Content />
(I wait for some elements inside<Content />
to load, then I inform<Component />
that animation can begin andsetPlayState(PlayState.play)
. Because of the re-rendering it is not possible because<Content />
stuff are reloaded, the animation begins before it has fully loaded.I don't think this is currently possible due how react-gsap is structured because content is a rendered prop of
<Timeline />
. I understand this was done this way in order to be able to set the targets but IMO we should be able to separate content and animation in the React tree.I tried to make it clear and I hope I am not doing anything too weird.
The text was updated successfully, but these errors were encountered: