Jump to content

Change opacity of the emitter?


woratana
 Share

Recommended Posts

I was wondering that myself when I started...

Then it occurred to me that an emitter is just an extended group, so you get access to all the group functions, like forEachAlive!

What I do is put this in the update function:

myEmitter.forEachAlive(function(particle){    particle.alpha = game.math.clamp(particle.lifespan / 1000, 0, 1);}, this);

This will fade out each particle in the last second of its life...

 

For added effect, you can change the lifespan of individual particles when you create them.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...