简体   繁体   English

如何使A帧动画正确进出?

[英]How do I make an A-Frame animation ease in and out correctly?

After reading A-Frame's animation docs and playing with different easing functions, I still can't make this example pulse out and back in: 在阅读了A-Frame的动画文档并使用了不同的缓动函数之后,我仍然无法使该示例跳出返回:

<a-scene background="color: #FAFAFA">
   <a-entity id="mouseCursor" cursor="rayOrigin: mouse" raycaster="objects: #circle"></a-entity>
   <a-circle id="circle" color="black" position="0 1.8 -3" radius=".7" material="opacity: 0.5" animation="property: radius; from: 0; to: 0.7; dur: 1000; easing: easeInOutSine; loop: true;"></a-circle>
</a-scene>

Here is a codepen example of how it should animate. 这是一个应如何动画的codepen示例

You need to provide a direction for the animation - if you want it to alternate then use dir: alternate : 您需要提供动画的方向 -如果您希望动画交替播放,请使用dir: alternate

<a-circle id="circle" color="black" position="0 1.8 -3" radius=".7" material="opacity: 0.5" 
         animation="property: radius; from: 0.01; to: 0.7; dur: 1000;
         easing: easeInOutSine; dir: alternate; loop: true;"></a-circle>

fiddle here . 在这里摆弄。


also you can't make the radius go 0 because three will pop up an error: 您也不能使半径为0因为三个会弹出错误:

THREE.DirectGeometry: Faceless geometries are not supported.

you can either change 0 -> 0.001, or animate the scale from 1 1 1 to 0 0 0 您可以更改0-> 0.001,或将scale1 1 10 0 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM