Closed CrandellWS closed 3 years ago
Not rendering depends on how you have set up your renderer. Only rendering when there are particles would be fine if you are solely responsible for calling renderer.render()
(although you'd want to render once with 0 particles just to clear the screen); if you are using an Application
from PixiJS, you should be able to pause the application or its ticker when there are no particles remaining.
Particle count is controlled by the emitter settings frequency
and emitterLifetime
. You can see that for this example emitter, it emits (0.05 / 0.31 = 6) particles in rapid succession, before turning itself off.
The coin example does not seem to use Application
how would i convert this to Application?
also i dont see where the 6 particles are set can you point to that specific code? Also dont see (0.05 / 0.31) anywhere...
thanks again sorry I am new to pixijs and feel confused on these issues
ok I found the emitter answer so I am still stuck on how to pause this example when there is no particles
The particle examples here are not good examples for how to set up a PixiJS project, because they are specifically designed to show off what pixi-particles can do. For basic setup, https://pixijs.io/examples/#/demos-basic/container.js is a good example of how to start a PixiJS Application and attach an update listener. The example in the readme for pixi-particles then shows you how to set up your emitter. You can use the playOnce
method on your emitter to start playing the particle animation and get a callback when it completes, when you would then stop the application's ticker.
thanks that tip helped, sorry i forgot to close the thread have a good night.
I wanted to optimize https://github.com/pixijs/pixi-particles/blob/gh-pages/examples/coins.html
but I am not sure how... I would like to pause everything when the coins are not there...
I tried not rendering the stage if there were no particles:
any other suggestions?
also on a side note I noticed each click generates 6 particles how can i change that number?