pixijs / particle-emitter

A particle system for PixiJS
http://pixijs.io/particle-emitter/docs
MIT License
793 stars 125 forks source link

callback function for playOnce is called multiple times #106

Closed herrKlein closed 5 years ago

herrKlein commented 5 years ago

My callback function is called repeatedly after the first time I called playOnce.

After the emitter has finished update still is called and this._completeCallback(); keeps being called because its not emitting and there are no active particles.

Maybe this._completeCallback should be nullified?

        //if we are all done and should destroy ourselves, take care of that
        if (!this._emit && !this._activeParticlesFirst)
        {
            if (this._completeCallback)
            {
                this._completeCallback();
            }
            if (this._destroyWhenComplete)
            {
                this.destroy();
            }
        }
kevincastejon commented 5 years ago

Same here, using PIXI V5, except that not only the callback is called repeatly but the particles emission is also looping...

andrewstart commented 5 years ago

Yep, the callback should be nulled. It works fine with playOnceAndDestroy(), but not playOnce().