AFrame:更新实体';具有多个属性的s-a动画

AFrame:更新实体';具有多个属性的s-a动画,aframe,Aframe,有人知道如何更新动画以更改多个属性吗?示例:3个按钮,全部用于更改a动画的旋转。第一个按钮对长方体的旋转动画为30 0,第二个按钮对同一长方体的旋转动画为0 90 0,第三个按钮对同一长方体的旋转动画为100 0 10。每个按钮都在调用a动画的id 我“激活”了第一个按钮的动画,但是其他两个没有 您可以有三个由不同事件触发的单独动画: <a-box id="box"> <a-animation attribute="rotation" begin="button1click

有人知道如何更新动画以更改多个属性吗?示例:3个按钮,全部用于更改a动画的旋转。第一个按钮对长方体的旋转动画为30 0,第二个按钮对同一长方体的旋转动画为0 90 0,第三个按钮对同一长方体的旋转动画为100 0 10。每个按钮都在调用a动画的id


我“激活”了第一个按钮的动画,但是其他两个没有

您可以有三个由不同事件触发的单独动画:

<a-box id="box">
  <a-animation attribute="rotation" begin="button1click"></a-animation>
  <a-animation attribute="rotation" begin="button2click"></a-animation>
  <a-animation attribute="rotation" begin="button3click"></a-animation>
</a-box>
然后将组件连接到按钮(无论它们是什么):


你能粘贴一些代码吗?
AFRAME.registerComponent('emit-on-click', {
  schema: {
    target: {type: 'selector'},
    event: {type: 'string'}
  },

  init: function () {
    var el = this.el;
    var targetEl = this.data.target;
    var eventName = this.data.event;

    el.addEventListener('click', function () {
      targetEl.emit(eventName);
    })
  }
});
<a-entity id="button1" emit-on-click="target: #box; button1click"></a-entity>
<a-entity id="button2" emit-on-click="target: #box; button2click"></a-entity>
<a-entity id="button3" emit-on-click="target: #box; button3click"></a-entity>