简体   繁体   English

如何在A形框架中绘制曲线?

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

I'm getting started with A-Frame and this is a very basic question. 我正在开始使用A-Frame,这是一个非常基本的问题。 I checked a number of examples to draw a line and then a curve in A-Frame but they don't show up in the scene. 我检查了许多示例以绘制一条线,然后在A-Frame中绘制一条曲线,但是它们没有出现在场景中。 I have a plane there that shows up correctly. 我那里有一架飞机,可以正确显示。

I can use document.querySelector('a-plane').object3D; 我可以使用document.querySelector('a-plane').object3D; to get the plane but document.querySelector('a-curve').object3D; 获取飞机但是document.querySelector('a-curve').object3D; returns undefined. 返回未定义。

Here is a code sample: 这是一个代码示例:

<!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>

You need to import the JS component that provides <a-curve> . 您需要导入提供<a-curve>的JS组件。 It's a community component. 这是社区的组成部分。

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

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

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