Aframe光标动画未显示

时间:2019-03-17 21:19:13

标签: aframe

我必须动态添加光标。

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的帧

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

1 个答案:

答案 0 :(得分:1)

SELECT safe_cast((SELECT up.value.string_value FROM UNNEST(user_properties) up WHERE key = "user_id") AS INT64) AS user_id, (TIMESTAMP_MILLIS(CAST(event_timestamp/1000 AS INT64))) AS event_date has been deprecated in 0.9.0。请改用animation component