收藏
回答

如何监听xrframe模型组件的动画状态?

<xr-asset-load type="gltf" asset-id="{{modelitem.uid}}" src="{{modelitem.url}}"/><xr-gltf  id="{{modelitem.uid}}" model="{{modelitem.uid}}" position="{{modelitem.position}}"  scale="{{modelitem.scale}}"  bind:gltf-loaded="handleGLTFLoaded"  bind:anim-stop="handleAnimationStop"/>我有个需求是监听animator播放,暂停和停止状态,目前只知道在动画组件绑定anim-stop方法还有其他监听状态的实现方法吗

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

1 个回答

  • 棒棒冰
    棒棒冰
    05-23

    animator中有个私有属性_currents对象,通过这个对象可以获取到当播放动画的状态(动画播放中通过帧循环获取)

    const playState = animator._currents[animName];
    
    05-23
    有用 1
    回复 2
    • 柴思敏Smile
      柴思敏Smile
      星期二 11:30
      animator.onTick((deltaTime, data) => {
          console.log(’onTick‘, deltaTime, data);
         })你使用过该方法吗,这个方法我一直没有效果
      星期二 11:30
      回复
    • 棒棒冰
      棒棒冰
      星期三 10:51回复柴思敏Smile
      不能这样用,通过event来实现
      星期三 10:51
      回复
登录 后发表内容