2017-02-01 79 views
0

您好我正在使用aframe的主分支,並且新文本「組件」似乎低於它所在的實體的分配高度,並帶有一些看不見的東西。 Codepen在這裏http://codepen.io/anon/pen/PWQXRP並嘗試移動到實體下方。此代碼是從360圖像畫廊,樣板回購修飾延伸過去實體高度的Aframe文本實體

<body> 
<a-scene> 
    <a-assets> 
    <img id="cubes" crossorigin="anonymous" src="https://cdn.aframe.io/360-image-gallery-boilerplate/img/cubes.jpg"> 
    </a-assets> 
    <a-sky id="image-360" radius="10" src="#cubes"></a-sky> 


    <a-entity layout="type: line; margin: 1.5" position="0 0 -3"> 
    <a-entity 
       geometry="primitive: plane; height: 0.55; width: 1.9" 
       material="shader: flat; color: red" 
       text="value: Hello Worldllo Worldllo Worldllo Worldllo Worldllo Worldllo Worldllo Worldllo Worldllo Worldllo Worldllo World; color: black"></a-entity> 
    </a-entity> 

    <a-entity camera look-controls wasd-controls> 
    <a-cursor id="cursor" 
     animation__click="property: scale; startEvents: click; from: 0.1 0.1 0.1; to: 1 1 1; dur: 150" 
     event-set__1="_event: mouseenter; color: springgreen" 
     event-set__2="_event: mouseleave; color: black"></a-cursor> 
    </a-entity> 
</a-scene> 

新AFRAME所以不知道我在做什麼錯

回答

0

https://aframe.io/docs/master/components/text.html#scaling-geometry-to-fit-text

縮放適合文本的幾何圖形

要讓幾何圖形自動按照文本進行縮放,請使用s將幾何組件的寬度和高度屬性設置爲自動,並根據需要設置文本組件的寬度。在這個例子中,飛機的寬度將被設置爲4個單元,它的高度將被設置爲匹配文本的實際高度:

<a-entity 
    geometry="primitive: plane; height: auto; width: auto" 
    material="color: blue" 
    text="width: 4; value: This text will be 4 units wide."></a-entity> 

需要注意的是,如果沒有形狀,也沒有文字指定寬度,文本寬度屬性默認爲1單位(米),幾何寬度屬性也將變爲1單位。

<a-entity 
    geometry="primitive: plane" 
    material="color: blue" 
    text="value: 1-wide\ndefault."></a-entity>