Jump to content

Change opacity of the emitter?


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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