【问题标题】:Unable to set the trigger event for an animation in a-frame project无法为一帧项目中的动画设置触发事件
【发布时间】:2019-09-20 02:59:42
【问题描述】:

我遇到了无法正确设置动画触发事件的问题

  • 我有一个光标
  • 它应该在指向特定实体时自行设置动画
  • 动画属性中“startEvents: fusing”的属性值对以及“fuse”和“fused”等其他变体不起作用

我的 a-frame 版本是 0.9.2

<a-camera position="0 3 0"
          wasd-controls 
          look-controls>

    <!-- Cursor (NOTE: having issues with animation here)-->
     <a-cursor fuse="true"
               fuse-timeout="250"
               position="0 0 -1"
               geometry="primitive: ring; 
                         radiusInner: 0.02; 
                         radiusOuter: 0.03"
               material="color: white; 
                         shader: flat;
                         opacity: 0.5"
               raycaster="objects: .clickable"
               scale="1 1 1"
               animation="startEvents: fusing;
                          property: scale;
                          from: 1 1 1;
                          to: 0.5 0.5 0.5;
                          dur: 500"
                                  >
                <a-circle radius="0.01"
                          color="white"
                          opacity="0.5"
                          material="shader:flat"></a-circle>

        </a-cursor>
</a-camera>


<a-entity class="orb clickable"
    id="orb0"
    scale="1 1 1"
    position="0 3 -6">  </a-entity>

【问题讨论】:

    标签: aframe


    【解决方案1】:

    光标需要是相机元素的子对象,像这样:

    <a-camera>
      <a-cursor animation="startEvents: fusing;...."></a-cursor>
    </a-camera>
    

    fusing 应该可以工作,mouseleave 将有助于在您将光标移离对象时更改光标。查看this fiddle

    【讨论】:

    • 我确实在 中有它(抱歉,我没有包含该代码,我试图简短地回答我的问题)
    • 我的小提琴是否按预期工作?主要是复制了你的代码
    • 是的,谢谢,我会仔细看看,看看能否找到关键的区别
    • 想通了 - 显然 无法触发该事件。所以我只能将“可点击”类添加到 。感谢您提供代码示例,以便我了解详细信息
    • not really 可能会提供您对实体所做的事情的示例:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多