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

Support rendering using a Painter #2193

Closed
dandc87 opened this issue Nov 30, 2022 · 2 comments · Fixed by #2442
Closed

Support rendering using a Painter #2193

dandc87 opened this issue Nov 30, 2022 · 2 comments · Fixed by #2442

Comments

@dandc87
Copy link

dandc87 commented Nov 30, 2022

Is your feature request related to a problem? Please describe.
I'd like to use a Lottie animation as a placeholder for images loaded via Coil, which only directly supports Painters

Describe the solution you'd like
An implementation of Painter which has the same constructor parameters as the LottieAnimation composable. I believe that since most of the logic is inside of the Canvas onDraw, it would be straight-forward to move into a Painter's onDraw.

Describe alternatives you've considered
Coil also allows for manual state management, which you could use to add and remove LottieAnimation to the composition. We currently do this, but it's not exactly intuitive.

Additional context
Coil similarly has their API support both a Painter (rememberAsyncImagePainter) and a composable (AsyncImage), both of which are handy in different situations.

gpeal added a commit that referenced this issue Dec 30, 2023
This allows Lottie to be used with anything that accepts a Painter (like Image).

Fixes #2193
@notAnElephant
Copy link

how do I use it though? Is there an example I could use?

@gpeal
Copy link
Collaborator

gpeal commented Apr 3, 2024

how do I use it though? Is there an example I could use?

Call rememberLottiePainter and then use it anywhere you would use a painter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants