-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Which react-spring target are you using?
-
@react-spring/web -
@react-spring/three -
@react-spring/native -
@react-spring/konva -
@react-spring/zdog
What version of react-spring are you using?
10.0.3
What's Wrong?
invalidate from r3f (with frameloop demand) in useSpring events seems to not work as expected. In this issue: #1707 the suggestion is to just call invalidate in the onChange but this has never had any effect for me.
For most animations, I have to use a combination of calling invalidate in the onStart and onRest events, and calling if (spring.position.isAnimating) invalidate() in r3f's useFrame. This usually works for a simple one-way animation, but if there are to steps or other sequencing it will freeze up at some point. (if I force an invalidation through other means the animation will continue).
Hopefully I'm just misunderstanding how to properly invalidate in this case, but I haven't seen anything in any of the related packages' docs. (is there official documentation on how to use react-spring/three with frameloop="demand"?)
In the repro I'm using a looped animation and, on load, the animation always runs like 1.5-2x then freezes; after that forcing an invalidate allows the animation to continue once. (of course using an infinitely looped animation with frameloop demand doesn't make much sense but it's just illustrative)
Also I'm not using the /web package anywhere so the issues about /three clashing with it aren't relevant (as far as i can tell)
To Reproduce
Set frameloop to demand and try to manually invalidate a looping animation.
Expected Behaviour
The animation to continue to play as I am calling invalidate in all the expected locations