Dragomirus
Dragomirus

Reputation: 449

LibGDX - Particle Effect Fade Out

So I have particle effect(with additive: false) and now I want to create beautiful fade out effect. I've tried to make something like that:

Color color = batch.getColor();
batch.setColor(color.r, color.g, color.b, color.a * alpha);

but it doesn't work for particle effect.

Does anyone know how to change alpha of particle effect?

Upvotes: 0

Views: 665

Answers (2)

Dragomirus
Dragomirus

Reputation: 449

Solution was pretty simple :D

All You need is:

m_particleEffect.getEmitters().get(0).getTransparency().setHigh(0.5f/*alpha*/);

Hope this will help someone :)

Upvotes: 1

Alex Taylor
Alex Taylor

Reputation: 8853

If you look at the ParticleEmitter.draw code, you'll see the blend mode of the drawing is controlled by the setAdditive (which you say you have set to false) and setPremultipliedAlpha methods. It looks like you want to use pre-multiplied alpha, but I'm unsure of how the batch color interacts with the texture color in LibGDX. Try setting pre-multiplied alpha to true first.

Upvotes: 0

Related Questions