jinatonic / confetti

An Android particle system library for displaying confetti!
https://medium.com/@jinatonic/its-parfetti-time-f40634472608
Apache License 2.0
1.31k stars 151 forks source link

Add a limit option to the number of confetti on screen #26

Open magneticflux- opened 7 years ago

magneticflux- commented 7 years ago

You can use some of the Guava caches here to optimize your confetto recycling and limit the number of active confetti on-screen. This should be completely configurable, since some devices are more powerful than others. The animator could keep track of the last frame-time and also dynamically adjust the value.

jinatonic commented 7 years ago

I want to avoid pulling in other libraries for this project to keep down the dex / apk impact of the library. We can build more configurable caching mechanism into the library if you have a use-case for it.

magneticflux- commented 7 years ago

@jinatonic I understand not wanting to include more libraries, and I think the same thing could be accomplished by checking the size of the queue for recycled confetti compared to some limit value.

My use case would be as a safeguard against straining the user's device. It can be hard to gauge how many confetti will be onscreen at once just from the emission rate, so having an absolute max is useful to prevent absurd values from lagging the animation.