How to embed an aframe scene into a div

别来无恙 提交于 2019-12-06 01:21:47

A-Frame's embedded component is intended to remove fullscreen styles, allowing you to style/size the canvas as needed.

<a-scene embedded></a-scene>

More details here: https://aframe.io/docs/0.3.0/components/embedded.html

Don McCurdy, Thank you for pointing me in the right direction. I was able to finally change the scene window size.
Here is the code to accomplish this.

HTML:

<a-scene class="aframebox" embedded>

    <a-sphere position="0 1.25 -1" radius="1.25" color="#EF2D5E"></a-sphere>
    <a-box position="-1 0.5 1" rotation="0 45 0" width="1" height="1" depth="1"  color="#4CC3D9"></a-box>
    <a-cylinder position="1 0.75 1" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
    <a-plane rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>

    <a-sky color="#ECECEC"></a-sky>
    <a-entity position="0 0 3.8">
        <a-camera></a-camera>
    </a-entity>
</a-scene>

CSS:

.aframebox {
height: 500px;
width: 500px;
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!