New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make speed density independent #249
make speed density independent #249
Conversation
Hey @cmt218, my bad for not responding earlier to this PR. Thanks a lot for this contribution.
You're absolutely right, this is expected behavior to ensure the same effect and experience across different form factors.
Since this behavior is in the library for a long time already I can imagine this would definitely change the desired behavior for some apps since it could change the effect a little bit. If we only do an update with this change and also add The implementation looks good. If you could add the suggested |
…ove in terms of pixels or dip
@DanielMartinus no worries! Updated this to be configurable via |
@cmt218 tested it and works great! About the default value for The argument for that is that we're sure that everyone implementing it in the future will have the same behavior across all different form factors. The argument against would be that everyone updating to the latest version will visible change their desired behavior probably going unnoticed. They can easily opt-out with the boolean you added. However, we should not be making non-breaking changes that visibly changes the rendering especially since Konfetti is often implemented in places that don't get tested every day so it can go unnoticed when people update to the latest version. Option three would be to deprecate Just writing down my thought process here, what do you think of that? |
@DanielMartinus I agree with you 100% that deprecating I could not come up with a satisfying way to also account for acceleration with a new |
I see, let's go for what you're suggesting indeed and keep it with the boolean but indeed instead defaulting it to true 👍 |
Updated! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!! 💯
Hi @DanielMartinus!
I noticed in my project that devices with low pixel density had much higher particle velocity than I had developed for and realized that this is because velocity is in terms of pixels and not dip in the library. Here is a comparison between 5 inch ldpi and xxhdpi devices with no change on the simple demo:
LDPI: XXHDPI:
as you can see the particles on the ldpi device are traveling 4x as fast as the xxhdpi device. Here is a comparison after the change:
LDPI: XXHDPI:
I would expect that velocity remaining constant across pixel densities is desired behavior, but if you think that some might not want this I would be happy to update the PR so that this is an option passed to the particle system (something like
setSpeedPixelIndependent()
). Thanks for the great library!