【问题标题】:How to increase the acceleration of parent animation in aframe?如何增加aframe中父动画的加速度?
【发布时间】:2021-12-31 10:06:18
【问题描述】:
<a-entity class="rota" id="duck1" color="#fdfd96" scale="0.1 0.1 .1" position="2 0 -7" animation="property: rotation; to:0 -360 0; loop:true; easing:linear; dur:30000">
            <a-entity class="rota" color="#F0FFF0" gltf-model="spaceship.glb" animation__mouseenter="property: rotation; to:0 360 0; easing:linear; dur:4000; startEvents: mouseenter" position="20 0 -10"  scale="2 3 3" collison-check="el: #otherduck; radius: 0.15; other-radius: 0.15;"> </a-entity>
        </a-entity>

这里有两个“实体”:一个是父级,另一个是子级。父实体的动画与dur:30000 一起正常工作。在子实体中,我想将“dur”减少到dur:4000。我该如何改变呢?

【问题讨论】:

    标签: aframe


    【解决方案1】:

    您可以使用子级上的事件集组件来更改父级动画的属性。 https://www.npmjs.com/package/aframe-event-set-component

    <a-entity class="rota" color="#F0FFF0" gltf-model="spaceship.glb" 
     event-set__1="_event: mouseenter; _target:#duck1; animation.dur:4000"
     position="20 0 -10"  scale="2 3 3" collison-check="el: #otherduck; radius: 0.15; 
     other-radius: 0.15;"> </a-entity>
    

    当您更新已播放动画的持续时间时,我不确定动画组件的具体行为是什么。

    通过快速阅读代码,动画看起来像是重新开始了。由于您没有指定从位置,这应该意味着它只是从它到达的位置继续。希望这就是您希望发生的事情。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-05
      • 1970-01-01
      • 2021-07-19
      相关资源
      最近更新 更多