-
I've been looking through the examples on R3F for the birds and block matrix and am close to setting the position of each element but can't quite figure out how to pass change the position of a 'prop' as opposed to a Object3d. I think this must be a simple react thing but I am terribly new. Many thanks.
The thing I'd like is to shift the control of the movement away from the child component (Text) and into the parent component, so that different groups of children can be moved together more easily. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
react is all about top down data or on directional flow. state > view, as in the view is a mere reflection of state. the parent must have the data, and it forwards that data to its children by props. if you refer to the useFrame and you want to set position in there, then why not simply ref.current.children.forEach(child => ... ? here's an example with group children in a useframe https://twitter.com/0xca0a/status/1328130549198811142 |
Beta Was this translation helpful? Give feedback.
react is all about top down data or on directional flow. state > view, as in the view is a mere reflection of state. the parent must have the data, and it forwards that data to its children by props.
if you refer to the useFrame and you want to set position in there, then why not simply ref.current.children.forEach(child => ... ?
letters
is a collection of vdom elements, these are not threejs objects.here's an example with group children in a useframe https://twitter.com/0xca0a/status/1328130549198811142