【问题标题】:How to run A-Frame code from another file to prevent clutter?如何从另一个文件运行 A-Frame 代码以防止混乱?
【发布时间】:2019-05-09 06:43:02
【问题描述】:

使用 A-Frame 会造成很多混乱。他们是从另一个文件访问代码的方法吗?如果不是,那么您建议使用什么来防止集群?我的代码是公开的@https://repl.it/@ColbzDaBoss1/A-Frame-Test

谢谢 :) 科尔比比安科

【问题讨论】:

    标签: aframe


    【解决方案1】:

    使用组件:https://aframe.io/docs/0.9.0/introduction/writing-a-component.html

    <script src="my-component.js"></script>
    <a-scene>
      <a-entity my-component></a-entity>
    </a-scene>
    

    组件文件:

    AFRAME.registerComponent('my-component', {
      init: function () {
      }
    });
    

    【讨论】:

    • 所以我认为这行得通......但我不能运行像&lt;a-plane position="0 0 -2" rotation="-90 0 0" width="5" height="5" color="#7BC8A4"&gt;&lt;/a-plane&gt; 这样的东西,因为它是html。此代码是否有等效的 JavaScript?谢谢!!!
    猜你喜欢
    • 2022-01-18
    • 1970-01-01
    • 2018-11-10
    • 2019-01-30
    • 1970-01-01
    • 2017-03-27
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多