Skip to content
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

Add support for Emoji/Text confetti Shapes #299

Merged
merged 2 commits into from Dec 2, 2023

Conversation

jasonctoms
Copy link

@jasonctoms jasonctoms commented Jun 10, 2022

It would be nice to have the ability add emojis to the confetti.

These updates only update the "engine" to support adding emojis. I have found that they look better without the 3D rotation, so in my own project I have changed that part of the rotation code to look like so:

particles.forEach { particle ->
                withTransform({
                    if (particle.shape is Shape.Text) {
                        rotate(
                            degrees = particle.rotation,
                            pivot = Offset(
                                x = particle.x,
                                y = particle.y
                            )
                        )
                    } else {
                        rotate(
                            degrees = particle.rotation,
                            pivot = Offset(
                                x = particle.x + (particle.width / 2),
                                y = particle.y + (particle.height / 2)
                            )
                        )
                        scale(
                            scaleX = particle.scaleX,
                            scaleY = 1f,
                            pivot = Offset(particle.x + (particle.width / 2), particle.y)
                        )
                    }
                }) {
                    particle.shape.draw(this, particle)
                }
            }

But I do not know if you want this part of the composable to be configurable or not. I am open to suggestions (if you even want to add emoji support).

I could not add anything to the samples since they use the pre built dependency, but here is a video of what it looks like from my own project:

device-2022-06-10-125027.mp4

@DanielMartinus
Copy link
Owner

DanielMartinus commented Jul 14, 2023

This sounds like a great idea. I would have to dive deeper into this and do some tests!

Sorry for replying a year later

Copy link
Owner

@DanielMartinus DanielMartinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jasonctoms. I'll merge the code, look at the rotation part and will make sure it's added to the samples as well

@DanielMartinus DanielMartinus merged commit e8ac73c into DanielMartinus:main Dec 2, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants