简体   繁体   English

如何在 aframe.js 中使用 html 表单?

[英]How can I use html form with aframe.js?

I am creating a 3d web page for laptop use only.我正在创建一个仅供笔记本电脑使用的 3d 网页。

How should I enable text input and use HTML form library in HTML?我应该如何启用文本输入并在 HTML 中使用 HTML 表单库?

I have found various API to print text on 3d web page but no any related to HTML form.我找到了各种 API 来在 3d 网页上打印文本,但与 HTML 表单没有任何关系。 What should I do?我该怎么办?

WebGL is a different environment from the 2D Web. WebGL 是与 2D Web 不同的环境。 It is non-trivial to pull in normal HTML forms and enable text input.拉入正常的 HTML 表单并启用文本输入并非易事。 In WebGL, forms, UI, and input have to be built from the ground up until someone creates a nice library or component for it.在 WebGL 中,表单、UI 和输入必须从头开始构建,直到有人为它创建了一个不错的库或组件。 It also depends on what devices are available.它还取决于可用的设备。

I don't know how far you'd get with DOM-to-canvas-to-texture implementations like https://github.com/mayognaise/aframe-html-shader , that might be good place to look at.我不知道像https://github.com/mayognaise/aframe-html-shader这样的 DOM-to-canvas-to-texture 实现你能走多远,这可能是一个值得关注的好地方。

Or to build from the ground up:或者从头开始构建:

  • Represent your form through meshes (planes and boxes) and text.通过网格(平面和框)和文本表示您的形式。
  • Listen to keyboard events to append and modify text from your form.监听键盘事件以追加和修改表单中的文本。
  • Create a button through a mesh and listen for user input to submit the form.通过网格创建一个按钮并监听用户输入以提交表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM