【发布时间】:2021-07-05 00:35:09
【问题描述】:
我写了下面的代码
最后,当将touchPoint设置为to时,它不起作用。
// getModel
const model = document.getElementById('model')
// getPlaceGround
const ground = document.getElementById('ground')
// click ground
ground.addEventListener('click', (event) => {
console.log('clicked ground')
// get touch position
const touchPoint = event.detail.intersection.point
console.log(touchPoint) // touchPoint
console.log(touchPoint.x) // touchPoint.x
console.log(touchPoint.y) // touchPoint.y
console.log(touchPoint.z) //// touchPoint.z
试过了
1:不好
2:不好
3:不好
4:不好
5:很好但是,我想设置变量
6:很好但是,我想添加动画
model.setAttribute('animation', 'property: position; to: touchPoint')
model.setAttribute('animation', 'property: position; to: touchPoint.x touchPoint.y touchPoint.z ')
model.setAttribute('animation', `property: position; to: ${touchPoint}`)
model.setAttribute(`'animation', 'property: position; to: ${touchPoint}'`)
model.setAttribute('animation', 'property: position; to: -4 -4 2')
model.setAttribute('position', touchPoint)
【问题讨论】:
标签: javascript animation aframe