pixijs / particle-emitter

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

Better documentation on how to migrate to v5. #163

Open hood opened 3 years ago

hood commented 3 years ago

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.

andrewstart commented 3 years ago

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.

hood commented 3 years ago

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.

andrewstart commented 3 years ago

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

hood commented 3 years ago

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

andrewstart commented 3 years ago

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.