簡體   English   中英

如何在A形框架中繪制曲線?

[英]How to draw a curve in A-frame?

我正在開始使用A-Frame,這是一個非常基本的問題。 我檢查了許多示例以繪制一條線,然后在A-Frame中繪制一條曲線,但是它們沒有出現在場景中。 我那里有一架飛機,可以正確顯示。

我可以使用document.querySelector('a-plane').object3D; 獲取飛機但是document.querySelector('a-curve').object3D; 返回未定義。

這是一個代碼示例:

<!DOCTYPE html>
<html>
  <head>
    <title>A-frame room</title>
    <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
  </head>
  <body>
    <a-scene>
        <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4">   </a-plane>
        <a-sky color="#ffffff"></a-sky>
        <a-curve type="CatmullRom" curve="closed:true" visible="true">
            <a-curve-point id="checkpoint1" position="0 0 -4" visible="true"></a-curve-point>
            <a-curve-point id="checkpoint2" position="0 10 -4" visible="true"></a-curve-point>
            <a-curve-point id="checkpoint3" position="0 10 -8" visible="true"></a-curve-point>
            <a-curve-point id="checkpoint4" position="0 0 -8" visible="true"></a-curve-point>
        </a-curve>
    </a-scene>
  </body>
</html>

您需要導入提供<a-curve>的JS組件。 這是社區的組成部分。

https://www.npmjs.com/package/aframe-curve-component

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM