-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions about <lume-scroller> and <lume-flex> integration with r3f and dynamic object ordering #312
Comments
Hello, thanks for checking it out! 1)
It is possible, yeah. I haven't tried combining r3f+lume, but I have combined lume with plain Threejs. I can make a small demo. Basically every Lume element has the property To do the integration, we would probably want to make the lume-flex layout in Lume, f.e. <lume-flex>
<lume-flex-item></lume-flex-item>
<lume-flex-item></lume-flex-item>
...etc...
</lume-flex> then for each of the child item, you could get the ref to your r3f component's threejs object, and then reach into the Lume element's threejs object to add it: function FlexItem() {
const lumeEl = useRef()
const meshRef = useRef()
// something like this
useEffect(() => {
lumeEl.current.three.add(meshRef.current)
}, [lumeEl.current, meshRef.current])
return <>
<lume-flex-item ref={lumeEl}></lume-flex-item>
<mesh ref={meshRef}></mesh>
</>
} Then in the higher up component 2)
Not currently but should be easy to add. Would it be easier to have that feature than, for example, ordering the items of the array itself that you const items = [{order: 3}, {order: 1}, {order: 2}]
// ...
return <lume-flex>{items.sort(...).map(...)}</lume-flex> |
Dear @trusktr , I sincerely thank you for your detailed and kind response. I was truly moved by your thoughtful and considerate reply, and I aspire to learn from and emulate your attitude. Once again, I am deeply grateful. I've followed your articles and writings for quite some time and knew that you were an exceptional person, but I didn’t expect you to be so kind and generous in responding to someone on the other side of the world. I hope to become someone with the same kindness and attitude that you have demonstrated. Regarding the question about ordering the items via .map in JSX: If dynamic ordering is possible with the method you suggested, I think it would be easier to change the order using .map. I am currently working on a small project, developing a website with 3D elements. However, I lack a lot of professional knowledge and don't have a solid foundation, so it's highly possible that the bug I mentioned earlier was due to my incorrect development or misuse of the tools I'm using. Given this situation, I feel a bit apologetic for requesting a specific feature from you. Once again, I truly appreciate your kind response and hope to see more of your work in the future. Thank you very much. Sincerely, |
No prob. Happy to be of any help! A goal with Lume is to make it helpful for people who want to achieve new features and effects for their web apps, so I'm happy to help out. :) |
Dear @trusktr,
Hello, my name is Karim, and I am a 3D web developer.
I came across your post on LinkedIn and wanted to leave a message. I saw that you plan to add two new elements: , which applies scroll based on the space an object occupies in a 3D scene, and , which positions objects like HTML's flex layout as new objects are added.
After watching the video, I couldn't contain my excitement. Thank you so much for creating such fantastic elements with high usability and versatility.
However, I have a few questions, which is why I’m writing this message.
Can ‘lume’ be used in parallel with r3f?
I am currently using r3f and handling flex layout with pmndrs/react-three-flex. However, it hasn't been updated for two years, and multiple bugs have made it almost unusable.
Therefore, I want to use the lume-flex that you are going to release, but I’d like to ask if it can be used alongside r3f. For example, can a lume element be integrated into an r3f scene, or can the new flex-scroll feature be used in an r3f scene?
Does lume-flex allow setting the order of objects within the flex layout?
One of the biggest issues with react-three-flex is that the order of objects cannot be dynamically changed. This forces me to change keys and re-render all elements from scratch whenever an object is added.
However, even this approach has caused many bugs, such as coordinates becoming misaligned or objects being placed in strange locations, leading me to stop using it. Can lume-flex automatically position objects when they are dynamically added and allow ordering?
Thank you for taking the time to read this long message.
thanks
The text was updated successfully, but these errors were encountered: