Skip to content

[Feature Request] Use fixed number of particles and duration instead of emission frequency and particles per emission #100

@Ali-Toosi

Description

@Ali-Toosi

Currently, you can only configure the emissionFrequency and numberOfParticles per emission. The problem with it is, it will behave differently on screens with different refresh rates. The same configuration will show many more particles on a 240 fps monitor compared to a 60 fps one.

I tried working around it by setting the emissionFrequency variable based on WidgetsBinding.instance.platformDispatcher.views.first.display.refreshRate to always get the same number of particles, which works fine on Desktop apps but not on Web.

The ConfettiController already has the duration set. It would be good to add a property to the widget like totalNumberOfParticles (mutually exclusive with setting emissionFrequency and numberOfParticles) which uniformly creates particles across the duration. That way, it will always be the same experience for the user, regardless of their display. The higher fps will only make the animation smoother for them, but the same number of particles will appear on the screen.

I am happy to add this and make a PR, but wanted to check the idea first.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions