plattysoft / Leonids

A Particle System for standard Android UI: http://plattysoft.github.io/Leonids/
Apache License 2.0
2.28k stars 398 forks source link

How to change TIMER_TASK_INTERVAL? #102

Closed moisoni97 closed 5 years ago

moisoni97 commented 5 years ago

I saw that in ParticleSystem class, TIMER_TASK_INTERVAL is set to 33 but it seems that particles are a little bit laggy. Changing it to a smaller number like 10 seems to solve te problem.

My question is: How to change it to 10 so it will work on my project?

moisoni97 commented 5 years ago

I implemented this library as module and changed TIMER_TASK_INTERVAL to 10 and it works very smooth now!

plattysoft commented 5 years ago

well, 33 is designed to run at a reasonable FPS (given that there are estandar views and not an OpenGL engine) Note that 33ms means 30 FPS, 10ms means 100 FPS. I don't think you would notice the difference from 60 FPS given how Android render views.

I don't think adding a parameter would be a good idea. If your particles take more than 10ms in calculating the position it would be a lot worse, since the timer tasks would be either dropped or blocked (I don't remember the algorithm right now)

You can check the code out and import it into your project as a library. You can also upload it to jfrog artifactory if you don't want the code in your project.

Maybe a handler running iterations as fast as they could would have been a better implementation. I might consider it.

Cheers.

On Mon, 26 Nov 2018 at 20:41 Moisoni Ionut notifications@github.com wrote:

I saw that in ParticleSystem class, TIMER_TASK_INTERVAL is set to 33 but it seems that particles are a little bit laggy. Changing it to a smaller number like 10 seems to solve te problem.

My question is: How to change it to 10 so it will work on my project?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/plattysoft/Leonids/issues/102, or mute the thread https://github.com/notifications/unsubscribe-auth/ABo0cQCbcflXuAM-PcylOCQj7X5yEp5Jks5uzFIOgaJpZM4Yzyne .