How to animate custom r3f components most performantly #2178
Unanswered
hatsumatsu
asked this question in
Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently testing
useTransition
in react-three-fiber and was wondering what the most performant way is to animate custom components.https://codesandbox.io/s/r3f-react-spring-transitions-5skgpc
In this test case I transition a custom component
<Item />
that contains an<animated.group />
.I pass the transition styles (like position and opacity) from the
useTransition
render function as props to use them inside the component.I was expecting the component to update/render frequently during the transition but logging rerenders showed that it just rerenders a few times (which seems great for perf!).
Next to it I wrapped my custom component via
animated
liekconst AnimatedItem = animated( Item )
. To my surprise this transition renders the component frequently during the transition.So am I right to assume that using a regular component and passing transition values as props is more performant than wrapping it via
animated()
?Beta Was this translation helpful? Give feedback.
All reactions