有没有办法设置连续动画?示例:基于相机旋转,每次相机旋转时围绕它旋转球体。
最佳答案
持续检查相机旋转并使用 tick 更新球体的组件:
AFRAME.registerComponent('rotation-updater', {
tick: function () {
var sphere = this.el;
var camera = this.el.sceneEl.cameraEl;
var cameraRotation = camera.getAttribute('rotation');
// var sphereRotation = DO SOMETHING WITH CAMERA ROTATION.
sphere.setAttribute('rotation', sphereRotation);
}
});
关于javascript - 设置连续动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41104714/