I have returned with question number two about points. My query this time revolves around changing the opacity from 0 to 1 and back within specific pixel distances from the emitter.
var particleCount = 14,
particles = new THREE.Geometry(),
pMaterial = new THREE.PointsMaterial({
map: new THREE.TextureLoader().load("x.png"),
blending: THREE.multiplyBlending,
flatShading: true,
size: 40,
transparent: true,
depthTest: true,
sizeAttenuation: true,
opacity: 1
});
var particleSystem;
I am confused because despite setting transparency, I am unable to adjust the value within the update function I created for my emitter.
function update() {
//particleSystem.rotation.y += 0.01;
pCount = particleCount;
while (pCount--) {
particle = particles.vertices[pCount];
(This is where a lot of validation is for the points)
particleSystem.geometry.verticesNeedUpdate = true;
particleSystem.rotation.y += (Math.random()*0.001)
}
Render loop:
renderer.setAnimationLoop(() => {
update();
composer.render(scene, camera);
});
I aim to have the particles fade out and not be visible in the scene for about 20 pixels, and then fade back in. However, I am unsure of how to modify the opacity as simply doing particle.opacity += 0.1 does not work.
Edit: I am also hesitant about adjusting the size, as I want to do a similar transition from 20 to 40. I could potentially base it on its Y coordinate. Nonetheless, I am unsure how to gradually change that as well.
Apologies if this question seems obvious or repetitive, I appreciate any assistance I receive. Any alternative approaches that I have come across are structured differently or involve arrays, which I am unsure how to implement in my desired way.
(Thank you in advance)