Is it possible to create Squircle shape in jetpack...
# compose
m
Is it possible to create Squircle shape in jetpack compose?
n
it is !
i'm not sure if it's rounded (and oyu can round only one corner if you want), but you can also draw your own custom shape easily
m
Thanks, I'll try
These are close to what I want
n
m
Actually I wanna use the shape for Card
I don't think so Canvas Shape is useful for Card
n
it's just to get the right "path"
each one of this sample use a Path() object to draw the shape, you just have to find/code the right method to create the Path to draw, and then use drawPath() in Compose, or Views, or anything
m
Nice, so first I get the path then I use that by CustomShape. Genius
👍 1
I got the solution, thanks man
Copy code
val SquircleShape = GenericShape { _, _ ->
    moveTo(0.0f, 100.0f)
    cubicTo(0.0f, 33.0f, 33.0f, 0.0f, 100.0f, 0.0f)
    cubicTo(167.0f, 0.0f, 200.0f, 33.0f, 200.0f, 100.0f)
    cubicTo(200.0f, 167.0f, 167.0f, 200.0f, 100.0f, 200.0f)
    cubicTo(33.0f, 200.0f, 0.0f, 167.0f, 0.0f, 100.0f)
    close()
}
👍 1
265 Views