简体   繁体   English

是否可以在A-frame a-text上使用表情符号?

[英]Is it possible to use emoji on A-Frame a-text?

I find it useful to use an emoji instead of an image in an a-text But I tried this: 我发现在表情a-text使用表情符号代替图片很有用,但是我尝试了以下方法:

<a-text value="&#1F601"></a-text>

And this: 和这个:

<a-text value="😁"></a-text>

And it doesn't seem to work (text is omitted). 而且它似乎不起作用(省略了文本)。

And yes, it's included in head: 是的,它包含在头部中:

<head>
  <meta charset="utf-8" />
</head>

Is it possible or is there a limitation with WebGL/ThreeJS/A-Frame? WebGL / ThreeJS / A-Frame是否可能或有限制?

Yes, if you have a font that comes with those glyphs. 是的,如果您具有这些字形随附的字体。 There are a bunch of fonts ready to use here: https://github.com/etiennepinchon/aframe-fonts I have not seen though anyone that includes emojis. 这里有很多字体可以使用: https : //github.com/etiennepinchon/aframe-fonts我还没有看到,尽​​管有人包含表情符号。

The optimal way would be to have a bunch of emojis in a spritesheet and then use something like https://github.com/ngokevin/kframe/tree/master/components/atlas-uvs to represent them individually. 最佳方法是在电子表格中包含一堆表情符号,然后使用https://github.com/ngokevin/kframe/tree/master/components/atlas-uvs之类的东西分别表示它们。

  <a-scene>
    <a-mixin id="emojis" atlas-uvs="totalRows: 4; totalColumns: 4" material="src: emojis.png" geometry="primitive: plane; buffer: false; skipCache: true"></a-mixin>

    <a-entity mixin="emojis" atlas-uvs="column: 1; row: 1"></a-entity>
    <a-entity mixin="emojis" atlas-uvs="column: 3; row: 2"></a-entity>
    <a-entity mixin="emojis" atlas-uvs="column: 2; row: 4"></a-entity>
  </a-scene>

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

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