我想让粒子系统出现在我的项目结束时,就像五彩纸屑一样。我所拥有的是这样的,但它不起作用,也没有将可见性设置为false,然后设置为true。不确定可以使用哪个属性来关闭可见性,然后打开。
html:
<a-entity id="confetti" particle-system="accelerationSpread: 20 0 20; color: white; enabled: false; particleCount: 300; opacity: 0.3; preset: default; size: 0.5; velocityValue: 0 15 0" position="5.584 1.250 -1.4" ></a-entity>js:
if (score == 7) {
function tada() {
congrats.setAttribute('visible', true);
confetti.setAttribute('enabled', true);
}
}谢谢!
发布于 2018-08-18 04:43:27
confetti.object3D.visible = false或confetti.removeAttribute('particle-system')
发布于 2020-10-23 22:10:28
您可以使用
AFRAME.utils.entity.setComponentProperty(confetti, 'particle-system.enabled', true);显然,setAttribute不支持多级组件。
https://stackoverflow.com/questions/51901736
复制相似问题