如何在A-Frame中显示文字? [英] How can I display text in A-Frame?
问题描述
对于 http://aframe.io/ ,如何在不创建图像的情况下呈现文本? / p>
For http://aframe.io/, how can I render text without having to create an image?
推荐答案
编辑::文本组件已落入A-Frame主分支。这将在0.5.0中推出。该组件将支持字体,对齐方式,锚点,基线,着色器等。< a-entity text = value:HELLO>< / a-entity>
https://aframe.io/docs/master/components/text.html
A text component has landed in A-Frame master branch. This will roll out in 0.5.0. The component will have support for fonts, alignments, anchors, baselines, shaders, etc. <a-entity text="value: HELLO"></a-entity>
https://aframe.io/docs/master/components/text.html
您可以使用某些社区组件:
You can use some of the community components:
- < a href = https://github.com/bryik/aframe-bmfont-text-component rel = nofollow noreferrer> https://github.com/bryik/aframe-bmfont-text-component -使用带符号的距离字段字体(无论缩放级别如何,位图字体都看起来不错)绘制的文本。
- https://npmjs.com/package/aframe-text-geometry-component -文本几何。
- https://github.com/maxkrieger/aframe-textwrap-component -Dr aw组件专注于文本环绕。
- https://github.com。 com / scenevr / htmltexture-component -HTML canvas as a texture。
- https://github.com/bryik/aframe-bmfont-text-component - Text drawn using signed distance field fonts (bitmap fonts that look great regardless of zoom level).
- https://npmjs.com/package/aframe-text-geometry-component - Text geometries.
- https://github.com/maxkrieger/aframe-textwrap-component - Draw component focused on text wrapping.
- https://github.com/scenevr/htmltexture-component - HTML canvas as a texture.
我建议使用位图字体文本组件
I recommend the Bitmap Font Text Component which is performant and looks visually good:
<html>
<head>
<script src="https://aframe.io/releases/0.2.0/aframe.min.js"></script>
<script src="https://rawgit.com/bryik/aframe-bmfont-text-component/master/dist/aframe-bmfont-text-component.min.js"></script>
</head>
<body>
<a-scene>
<a-entity bmfont-text="text: HELLO!; color: #333" position="0 0 -5"></a-entity>
</a-scene>
</body>
</html>
这篇关于如何在A-Frame中显示文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!