particle-emitter icon indicating copy to clipboard operation
particle-emitter copied to clipboard

Better documentation on how to migrate to v5.

Open hood opened this issue 4 years ago • 5 comments

As the titles says. Cannot import AnimatedParticle anymore after removing pixi-particles v4.3.1 and installing @pixi/particle-emitter v5.0.1 to replace it. I can see that it has been deprecated in v5 by looking at this commit: https://github.com/pixijs/particle-emitter/pull/158/commits/11b21f8e696aa01c19d01666970596f11bfae053, but I'd like to get some documentation on how to use animated particles under this new version. I've encountered other issues while following the examples, like PIXI.Texture.fromImage causing the following error to be thrown: Property 'fromImage' does not exist on type 'typeof Texture'. Using the upgradeConfig helper is not helping in any way, since I'm getting Uncaught TypeError: Cannot read property 'time' of null errors at runtime whenever I try to spawn a particle.

hood avatar Aug 28 '21 21:08 hood

Whoops, the Texture.fromImage() should have been Texture.from(). If you are seeing errors about a time property, then one of your behaviors that will end up with a PropertyList (color, alpha, speed, or scale) is misconfigured. I would have to see your config to know why.

andrewstart avatar Aug 29 '21 12:08 andrewstart

After quite some time spent adapting code to this new version, I've managed to avoid the runtime errors I was talking about. Now the problem is that particles aren't getting emitted at all. If you want/can help me, I can invite you to my project's repo (it's private), otherwise I can paste some excerpts of code here, but there's a lot of custom boilerplate stuff going on, so I should paste quite big chunks of text in order to give you some valuable context.

hood avatar Aug 29 '21 13:08 hood

You can invite me, and I'll take a look this evening.

andrewstart avatar Aug 29 '21 14:08 andrewstart

Done. You can use the pixi-particles-v5 branch to check the problematic code. It's mostly contained inside of the ParticlesManager class.

hood avatar Aug 29 '21 14:08 hood

For your circle spawn behaviors, r has been changed to radius. Additionally, ScaleBehavior was the only behavior using a minMult property that wasn't correctly catching undefined values, so you'll want to update to version 5.0.2 (which also fixes a bug with SingleAnimatedTextureBehavior.

andrewstart avatar Aug 29 '21 19:08 andrewstart