pixijs / particle-emitter

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

Can not use editor export json file - Format seems different #192

Closed stephanemill closed 1 year ago

stephanemill commented 1 year ago

Hi

I can not use the json file downloaded via https://pixijs.io/pixi-particles-editor/# Error is : Uncaught TypeError: config.behaviors is undefined

I have a code sample which is working fine with this array as part of the config :

behaviors: [
        {
            type: 'alpha',
            config: {
                alpha: {
                    list: [
                        {
                            value: 0.8,
                            time: 0
                        },
                        {
                            value: 0.1,
                            time: 1
                        }
                    ],
                },
            }
        },
... etc

and this "behavior" array is NOT present in the exported json file from the editor, which is causing the bug, i presume.

As i'm using the very last version of Emitter, I suppose the json generator is not update ? Thanks for reading and help !

stephanemill commented 1 year ago

Ok. I found this answer on the doc : On Emitter, configuration format has drastically changed. Use upgradeConfig() to convert old configuration objects automatically.

I have changed my code to this :

        `PIXI.particles.upgradeConfig( oldObjectFromEditor , ['./media/particle.png']);`

Works fine.