收藏
回答

xr-frame里keyframe动画设置为什么没有起作用?

{
  "keyframe": {
    "parent": {
      "0": {
        "rotation": [0, 0, 0]
      },
      "100": {
        "rotation": [0, 45, 0]
      }
    },
    "child": {
      "0": {
        "position.y": -0.5,
        "material.u_baseColorFactor": [0.48, 0.78, 0.64, 1]
      },
      "100": {
        "position.y": 1.5,
        "material.u_baseColorFactor": [0.176, 0.368, 0.937, 1]
      }
    }
  },
  "animation": {
    "parent": {
      "keyframe": "parent",
      "duration": 8,
      "ease": "linear",
      "loop": -1
    },
    "child": {
      "keyframe": "child",
      "duration": 4,
      "ease": "ease-in-out",
      "direction": "both",
      "loop": -1
    }
  }
}
------
<xr-scene bind:ready="handleReady">
  <xr-asset-material asset-id="simple" effect="simple" uniforms="u_baseColorFactor:0.8 0.4 0.4 1" />
  <xr-asset-load type="keyframe" asset-id="anim" src="../../assets/keyframes/test.json" />
  <xr-mesh node-id="cube" cast-shadow geometry="cube" uniforms="u_baseColorFactor:0.8 0.4 0.4 1" anim-keyframe="anim" anim-autoplay="clip:parent, speed:2"/>
  <xr-mesh position="0 -1 0" scale="4 1 4" receive-shadow geometry="plane" uniforms="u_baseColorFactor:0.4 0.6 0.8 1" />
  <xr-light type="ambient" color="1 1 1" intensity="1" />
  <xr-light type="directional" rotation="40 70 0" color="1 1 1" intensity="3" cast-shadow />
  <xr-camera clear-color="0.4 0.8 0.6 1" position="0 1 4" target="cube" />
</xr-scene>

在xrframe里,使用上面的keyframe,没有动画效果,请问哪里设置的不对吗?

回答关注问题邀请回答
收藏

1 个回答

  • 瞬光寂暗
    瞬光寂暗
    2023-03-21

    你先确定资源加载没有报错。

    2023-03-21
    有用
    回复 1
    • Whale fall🌱
      Whale fall🌱
      01-17
      和提问者一样,确定资源加载完毕了,test.json 动画没动
      01-17
      回复
登录 后发表内容