【问题标题】:aframe cursor animation not showing帧光标动画不显示
【发布时间】:2019-03-19 02:01:47
【问题描述】:

我不得不动态添加光标。

const cursorMaterial = {
    color: darkViolet,
    shader: 'flat',
    opacity: 0.9,
  }
  const cursorAttributes={
    fuse: true,
    fuseTimeout: cursorFuseTimeout,
    objects: '.clickable',
  }

export const cursorFuseTimeout = 2000
export const cursorFuseScale =  '0.5 0.5 0.5'

export const cursorClickAnimation = {
  begin: 'click',
  easing: 'ease-in',
  attribute: 'scale',
  fill: 'backwards',
  from: '0.1 0.1 0.1',
  to: cursorFuseScale,
  dur: 150,
}

export const cursorFuseAnimation = {
  begin: 'cursor-fusing',
  easing: 'linear',
  attribute: 'scale',
  fill: 'backwards',
  from: cursorFuseScale,
  to: '0.1 0.1 0.1',
  dur: cursorFuseTimeout,
}

  const recticle = document.createElement('a-entity')
  recticle.setAttribute('position', '0 0 -1')
  recticle.setAttribute('geometry', "primitive: ring; radiusInner: 0.02; radiusOuter: 0.026;")
  recticle.setAttribute('material', cursorMaterial)
  recticle.setAttribute('cursor', cursorAttributes)

  const clickAnim = document.createElement('a-animation')
  Object.keys(cursorClickAnimation).map(key => clickAnim.setAttribute(key, cursorClickAnimation[key]))

  const fuseAnim = document.createElement('a-animation')
  Object.keys(cursorFuseAnimation).map(key => fuseAnim.setAttribute(key, cursorFuseAnimation[key]))

recticle.appendChild(recticleBackground)
  recticle.appendChild(clickAnim)
  recticle.appendChild(fuseAnim)
  this.camera.appendChild(recticle)

光标按预期工作,但动画不再触发。

这是一帧 0.9.0

有没有更好的方法将这些添加到元素中?

【问题讨论】:

    标签: aframe


    【解决方案1】:

    a-animation has been deprecated 在 0.9.0 中。请改用animation component。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-23
      • 1970-01-01
      • 2013-12-02
      • 2012-08-05
      • 2019-10-27
      相关资源
      最近更新 更多