【发布时间】:2018-01-17 06:27:45
【问题描述】:
我正在使用 a-frame 在 WebVR 上制作一个项目,其中我加载了横幅和 a-box 元素的 collada 模型。单击模型时,我想围绕其轴旋转框。我使用了 javascript,但不是动画,而是直接旋转框,这与我们使用 a-frame 的动画标签时发生的情况非常不同。
<script>
function changeView() {
var view = document.getElementById("float");
view.setAttribute("rotation",
{
x: 0,
y: 360,
z: 0
});
}
</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>
【问题讨论】:
标签: javascript html three.js aframe webvr