使用画布的多个场景

问题描述:

我想使用A帧构建一个家庭游。房子有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>

+0

检查http://*.com/questions/38738147/how-to使用

+0

的src,因为我已经很长一段时间了,因为我再次摆弄aframe。谢谢,我会检查它 – Mokz

而不是试图建立多个场景,它会更容易,只是有你不同的房间定义为a-entity S和用javascript一次显示一个。然后,你可以只有一个场景的一切,并有一个简单的方法过渡动画(例如通过动画不透明的不同房间实体切换时)

+0

我明白了。我可以将它们全部加载到一个页面上,但是用''包装每个房间的组件。非常感谢你! – Mokz