首页 > 解决方案 > 从值动画到另一个值并返回重复 Aframe

问题描述

我是 Aframe 的新手,并试图在重复循环上上下动画 .glb 的位置,但似乎无法让它正常工作。这就是我所拥有的。

   <!--Text 3D OBJ-->
    <a-entity xrextras-one-finger-rotate gltf-model="#text-glb"  
      rotation="0 0 0" 
      scale="1 1 1"
      animation="property: position; 
                 from: 0 0 0;
                 to: 0 1 0;
                 direction: alternate;
                 dur: 5000; 
                 ease: linear"
       
    ></a-entity>

提前致谢!

标签: htmlanimationaframe

解决方案


方向属性称为dir,您需要将循环设置为true. 例如:

<a-sphere 
   animation="property: position;
              from: 0 1.25 -5;
              to: 0 3 -5;
              dir: alternate;
              dur: 1000; 
              ease: linear;
              loop: true"
   radius="1.25" 
   color="#EF2D5E">
</a-sphere>

可运行示例


推荐阅读