在 A-Frame 中动态更改相机
Change camera dynamically in A-Frame
我正在尝试一些可能很疯狂的事情。想法是,将鼠标悬停在球体上,用图像更改立体相机。默认相机将是立体相机,所以在 mouseleave 上我所要做的就是将主相机设置为活动状态并关闭辅助相机。是否可以将相机设置为 运行 时间?有什么帮助吗?提前致谢。
<a-assets>
<img id="image1" src="image1.png"/>
<img id="image2" src="image2.jpg"/>
</a-assets>
<a-camera >
<a-image position="0 0 -1" width="0.2" height="0.2" src="#image1">
</a-camera>
<a-camera stereocam position="-47 0 -35" >
<a-cursor fuse="true" color="black" position="0 0 -1" timeout="500" src="#warning">
</a-cursor>
</a-camera>
设置活动相机。
document.querySelector('#camera2').setAttribute('camera', 'active', true);
我正在尝试一些可能很疯狂的事情。想法是,将鼠标悬停在球体上,用图像更改立体相机。默认相机将是立体相机,所以在 mouseleave 上我所要做的就是将主相机设置为活动状态并关闭辅助相机。是否可以将相机设置为 运行 时间?有什么帮助吗?提前致谢。
<a-assets>
<img id="image1" src="image1.png"/>
<img id="image2" src="image2.jpg"/>
</a-assets>
<a-camera >
<a-image position="0 0 -1" width="0.2" height="0.2" src="#image1">
</a-camera>
<a-camera stereocam position="-47 0 -35" >
<a-cursor fuse="true" color="black" position="0 0 -1" timeout="500" src="#warning">
</a-cursor>
</a-camera>
设置活动相机。
document.querySelector('#camera2').setAttribute('camera', 'active', true);