Skip to content

Add a way to "unrandomize" the physics of a fetti instance. #236

@nzayatz14

Description

@nzayatz14

Hi there!

I am currently adding confetti on a button click that shoots up behind the button. I have 2 separate instances of confetti that I am showing on click of the button.

  1. A single text message "Thanks!" that goes straight up and down.
  2. A confetti of smiley face emojis.

Here is what I have currently:

Screen.Recording.2024-09-27.at.10.55.05.AM.mov

And here is a version without the smiley faces:

Screen.Recording.2024-09-27.at.10.43.08.AM.mov

I would like to make it so the "Thanks!" text pops up to the exact same height every time, but with the existing code structure it does not look like I can do that currently (I'm guessing by looking at the randomPhysics() function: https://github.com/catdad/canvas-confetti/blob/320381b361231b4eb51c4068ad73d125efad3121/src/confetti.js#L338C12-L338C25)

Would be it possible to add some sort of config item (or items?) that allow for disabling the randomness of the initial shot height?

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