canvas-confetti
canvas-confetti copied to clipboard
Add a way to "unrandomize" the physics of a fetti instance.
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.
- A single text message "Thanks!" that goes straight up and down.
- A confetti of smiley face emojis.
Here is what I have currently:
https://github.com/user-attachments/assets/73952394-7102-44a9-92a4-6c24812fde31
And here is a version without the smiley faces:
https://github.com/user-attachments/assets/ff9b8fe9-ada3-446d-a153-73a4d47be4bf
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!