-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
consider adding image shape type #80
Comments
Okay, so I am just thinking out loud here... You got me thinking when I read this issue, and obviously, I made this: But as much as I think that is super cool, there are some real problems. With rectangles and circles, we can do some very basic math and then draw an exact shape on the canvas. With anything else (and I played around with the idea of images, paths #81, and text #82), we need to relinquish all transformation to the canvas, which can be quite costly. In the example image above, the animation crawled... we are talking like 7fps. I am going to need to think about this a bit more and see if I can come up with something that performs well. |
Maybe it's possible to 'dumb down' the calculations by reducing complexity from matrices down to points. so deformation would be an option. At least this is what i understand in my humble understanding of the matter. |
I know this ticket is a year old, but I use this library extensively at the moment and would be interested in the ability to use emoji (or other small images) in place of the confetti. Would it be feasible to pre-render the rotation of the image to a sprite sheet during the loading or first pass and then use the sprite on subsequent renders to just plop the appropriate frame in place? |
I am not ruling that option out. I have been playing with it in the |
@catdad Do you have documentation on how to use your sprites branch? I'm currently using the script tag <script src="https://cdn.jsdelivr.net/npm/canvas-confetti/dist/confetti.browser.min.js" async></script>and this line in my typescript
and I would love to be able to use different images in the confetti. |
The sprites branch is not ready for production or even usable. It is a work in progress |
Hello @catdad , I want to use your outstanding work to make a snowflake mask. Snowflakes can be pictures or drawn on canvas. Is it supported in now version? Or do I need to wait for this feature to be merged? |
Next to rectangles and ellipses, i'd love to see the option of using images as particle shapes.
One could use it with the standard shape array like ['image', 'image', 'circle'] to accomodate for distribution of a single image next to common shapes.
To get the single image source, it would be one way to just define it in the confetti object like:
Another way could be defining a set of images in shapes as well: ['images']. Probability should fit the current system, but can be precised in its own child images' property.
To define them we use another object inside confetti:
Thanks for this awesome project which looks by far the best! ✌🥳
The text was updated successfully, but these errors were encountered: