0
我正在WebVR上使用a-frame制作一个项目,其中我已经加载了banner和a-box元素的collada模型。当模型被点击时,我想旋转框的轴。我使用JavaScript,但不是动画,而是直接旋转框,与我们使用框架的动画标签时发生的情况不同。如何在单击帧中的另一个对象时在对象上启动动画?
<script>
function changeView() {
var view = document.getElementById("float");
view.setAttribute("rotation",
{
x: 0,
y: 360,
z: 0 \t \t
});
}
</script>
<a-scene>
<a-assets>
<a-asset-item id="floatingbanner" src="models/floatingbanner.dae"></a-asset-item>
</a-assets>
<a-entity id="float" collada-model="#floatingbanner" position="-2 2 0" scale="0.3 0.3 0.3" onclick="loaddoc()">
</a-entity>
<a-box id="box" position="-1 1.5 0" onclick="changeView()" height=".3" depth=".3" width=".3"></a-box>
<a-camera id="view" position="0 0 0">
<a-cursor color="black"/>
</a-camera>
<a-scene>