【问题标题】:A-frame specific animations特定于 A 帧的动画
【发布时间】:2021-07-22 23:21:01
【问题描述】:

我在我的 A 帧场景 anf 中使用 gltf 模型,因为该模型有超过 1 个可用的动画,我想知道如何指定要播放的动画。这是我的模型的代码:

       <a-gltf-model
scale="0.1 0.1 0.1"
      src="https://cdn.glitch.com/18a85eac-a71c-4578-ad89-80f59b3a68c3%2Fscene%20(95).glb?v=1619716622287" nimation-mixer="clip:Take 001; loop:2; timeScale: 1; crossFadeDuration: 1"
              animation__position1="
                property: position;
                from: 0 0 0;
                to: 0 0 -5;
                dur: 5000;
                easing: linear;
                autoplay: true;"
            animation__position2="
                property: position;
                from: 0 0 -5;
                to: 5 0 -5;
                dur: 5000;
                easing: linear;
                startEvents: animationcomplete__position1">
        </a-gltf-model>

这是我从sketchfab下载的模型:https://sketchfab.com/3d-models/sci-fi-camera-drone-3dbf07385d1b471a96dce6de6cba97d6

动画当前无法正常工作,我想知道如何让模型像在sketchfab 中一样进行动画处理。

【问题讨论】:

    标签: javascript html css aframe virtual-reality


    【解决方案1】:

    您可以使用animation-mixer component:play gltf-model animations

    <html>
    <head>
      <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
      <script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.1/dist/aframe-extras.min.js"></script>
    </head>
    
    <body>
      <a-scene>
        <a-entity gltf-model="https://gftruj.github.io/webzamples/aframe/assets/models/mech_drone/scene.gltf" 
                  scale="0.01 0.01 0.01" position="0 0.5 -3" rotation="0 180 0" 
                  animation-mixer></a-entity>
      </a-scene>
    </body>
    
    </html>

    Willy Decarpentrie的模型


    播放特定动画需要指定剪辑:

    animation-mixer="clip: walk"
    

    【讨论】:

      猜你喜欢
      • 2016-12-15
      • 2021-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-20
      • 1970-01-01
      • 2022-12-07
      • 1970-01-01
      相关资源
      最近更新 更多