koreezgames / phaser3-particle-editor

A flexible editor for building phaser particles.
https://koreezgames.github.io/phaser3-particle-editor/
MIT License
169 stars 13 forks source link

[question] how to set particle's alpha as 0 when it is born? #40

Closed jcyuan closed 2 years ago

jcyuan commented 5 years ago

I'd like to have an effect: generate particle with alpha = 0, then fade in, then fade out...

DblK commented 2 years ago

A lot late, but I found the solution elsewhere. Here is the code:

emitter.setAlpha(function (p, k, t) {
  return 1 - 2 * Math.abs(t - 0.5);
});