Aframe 使用帧沿路径组件的a帧触发事件
在a帧中,使用帧沿路径组件,我想计算动画的每个循环。 我认为事件movingended不是用循环触发的?!Aframe 使用帧沿路径组件的a帧触发事件,aframe,Aframe,在a帧中,使用帧沿路径组件,我想计算动画的每个循环。 我认为事件movingended不是用循环触发的?! 当元素到达a曲线点X(可能是端点)时,如何使用激活的沿路径触发器?我的假设是错误的。每次循环移动都会触发 let ball = document.createElement('a-sphere'); ball.setAttribute('id', `Ball_${a}`); ball.setAttribute('class', 'clickable');
当元素到达a曲线点X(可能是端点)时,如何使用激活的沿路径触发器?我的假设是错误的。每次循环移动都会触发
let ball = document.createElement('a-sphere');
ball.setAttribute('id', `Ball_${a}`);
ball.setAttribute('class', 'clickable');
ball.setAttribute('src', `#tBall_${a}`);
ball.setAttribute(`alongpath`, `curve: .track${a}; dur: ${pathDuration}; delay: ${startdelay}; loop: true ;`);
ball.addEventListener("movingended", (e) => {
console.log("moving ended:" + bad_hits);
bad_hits++;
});
So i don't need alongpath-trigger-activated. But to answer my question:
let track = document.createElement('a-curve');
track.setAttribute('class', `track${a}`);
scene.append(track);
...
let point5 = document.createElement('a-curve-point');
point5.setAttribute('position', '0 3 -5');
point5.setAttribute('class', 'trigger');
point5.addEventListener("alongpath-trigger-activated", () => {
console.log("point 5 alongpath-trigger-activated");
});
track.append(point5);