DanielMartinus / Konfetti

Celebrate more with this lightweight confetti particle system 🎊
ISC License
3.13k stars 299 forks source link

Performance issues #307

Closed jofuelo closed 9 months ago

jofuelo commented 1 year ago

I'm building a game that starts some animations and throw konfetti when the use wins a match. What I've seen is that adding the konfetti causes little but noticeable lags in the app while it is playing. Is there a way to optimize/solve this issue? The code that I use to start the konfetti flow:

EmitterConfig emitterConfig = new Emitter(3L, TimeUnit.SECONDS).perSecond(100);
                konfetti.start(
                        new PartyFactory(emitterConfig)
                                .angle(Angle.RIGHT - 45)
                                .spread(Spread.SMALL)
                                .setSpeedBetween(10f, 80f)
                                .shapes(Shape.Square.INSTANCE, Shape.Circle.INSTANCE)
                                .colors(confettiColors)
                                .position(new Position.Relative(0.0, 0.5))
                                .build(),
                        new PartyFactory(emitterConfig)
                                .angle(Angle.LEFT + 45)
                                .spread(Spread.SMALL)
                                .setSpeedBetween(10f, 80f)
                                .shapes(Shape.Square.INSTANCE, Shape.Circle.INSTANCE)
                                .colors(confettiColors)
                                .position(new Position.Relative(1.0, 0.5))
                                .build()
                );
DanielMartinus commented 1 year ago

Hi @jofuelo, looks like you're using an older version of the library. Have you considered using the latest version?

On the specifics, are there a lot of other moving parts on the screen? There's no magic setting to make it more performant but would love to learn more about your specific situation where it's not performing really well. If you have anything that could describe or demonstration the situation that would be helpful!

DanielMartinus commented 9 months ago

Closing issue due to inactivity, please re-open if you'd like to revisit the issue