【问题标题】:Multiple a-scene using canvas使用画布的多个场景
【发布时间】:2016-08-23 01:14:13
【问题描述】:

我想使用 a-frame 构建房屋游览。这所房子有 6 间可供您探索的房间。我读过我们可以在场景中使用画布。我想知道是否可以有多个画布,例如 canvas="canvas: scene1"、scene2 等。

这是我第一个场景的示例代码

<a-scene canvas="canvas: scene1">
      <a-assets>
        <img id="abtus" src="images/about.jpg">
        <img id="led" src="images/2.jpg">
        <img id="crt" src="images/3.jpg">
        <img id="scm" src="images/4.jpg">
        <img id="dev" src="images/5.jpg">
        <a-mixin id="cube" geometry="primitive: box"></a-mixin>
        <a-mixin id="black" material="color: black"></a-mixin>
        <a-mixin id="yellow" material="color: #EB9C27"></a-mixin>
        <a-mixin id="link" geometry="primitive: plane; width: 0.8; height: 0.8">
        <a-mixin id="link-selected" geometry="primitive: plane; width: 1.4; height: 1.4">
        </a-mixin>
      </a-assets>

      <!-- camera -->
      <a-entity camera no-click look-controls>
        <a-entity id="cursor" position="0 0 -3"
                geometry="primitive: ring; radiusOuter: 0.1;
                          radiusInner: 0.05;"
                material="color: green; shader: flat"
                cursor="maxDistance: 900; fuse: true; timeout=1500">
        <a-animation begin="click" easing="ease-in" attribute="scale"
             fill="backwards" from="0.1 0.1 0.1" to="1 1 1" dur="150"></a-animation>
        <a-animation begin="fusing" easing="ease-in" attribute="scale"
             fill="forwards" from="1 1 1" to="0.1 0.1 0.1" dur="1500"></a-animation>
      </a-entity>
    </a-entity>
           <a-entity 
        geometry="primitive:sphere;radius:5000;segmentsWidth:64;segmentsHeight:64"
        material="shader:flat;color:#ffffff;fog:false;src:abtus"
        scale="-1 1 1"
        id="photosphere">
    </a-entity>
</a-scene>

【问题讨论】:

  • 使用 的 src
  • 很久没有再摆弄aframe了。谢谢,我去看看

标签: aframe


【解决方案1】:

与其尝试设置多个场景,不如将不同的房间定义为a-entitys 并使用 javascript 一次显示一个会更容易。然后,您可以只为所有场景设置一个场景,并通过一种简单的动画方式进行过渡(例如,通过在切换时对不同房间实体的不透明度进行动画处理)

【讨论】:

  • 我明白了。我可以将它们全部加载到一个页面上,但用“”为每个房间包装组件。非常感谢!
猜你喜欢
  • 2016-09-08
  • 1970-01-01
  • 1970-01-01
  • 2013-03-27
  • 1970-01-01
  • 2019-02-04
  • 1970-01-01
  • 1970-01-01
  • 2017-03-25
相关资源
最近更新 更多