Skip to content
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

HTML component #23

Closed
alvarosabu opened this issue Apr 2, 2023 · 0 comments · Fixed by #184
Closed

HTML component #23

alvarosabu opened this issue Apr 2, 2023 · 0 comments · Fixed by #184

Comments

@alvarosabu
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, there is no straightforward way to tie HTML content to any object of a TresJS scene and have it projected to the object's whereabouts automatically. This feature would be useful for users who want to create rich, interactive 3D scenes with HTML content that moves and scales along with the 3D objects.

Describe the solution you'd like
I would like to have a new HTML component that allows users to tie HTML content to any object in their TresJS scene. The component should support a variety of properties for customization, such as the wrapping element, className, positioning, scaling, occlusion, and more.

Suggested solution
In the TresJS library, we could provide the following implementation as a Vue component:

<template>
  <Html
    :as="'div'"
    :wrapperClass="wrapperClass"
    :prepend="prepend"
    :center="center"
    :fullscreen="fullscreen"
    :distanceFactor="10"
    :zIndexRange="[100, 0]"
    :portal="domnodeRef"
    :transform="transform"
    :sprite="sprite"
    :calculatePosition="calculatePosition"
    :occlude="occlude"
    :onOcclude="onOcclude"
    v-bind="groupProps"
    v-bind="divProps"
  >
    <h1>hello</h1>
    <p>world</p>
  </Html>
</template>

<script>
import { Html } from 'path/to/html-component';

export default {
  components: {
    Html,
  },
  // ...
};
</script>

This implementation should cover the desired features and provide users with the ability to create dynamic 3D scenes with HTML content.
https://github.com/pmndrs/drei/blob/master/src/web/Html.tsx

Additional context

This feature is inspired by the React Three Fiber (R3F) library, which provides a similar functionality for React users. Implementing this feature in TresJS would allow Vue developers to achieve the same level of interactivity and customization in their 3D scenes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant