UnitSpacePolygonShapeSample
@Sampled
@Composable
fun UnitSpacePolygonShapeSample() {
// A kite authored in the unit square [0..1] with per-vertex rounding in the same coordinate
// space. The shape scales and centers into any container preserving its aspect ratio.
val kite = remember {
PolygonShape(
PolygonShapeGeometry(
vertices =
listOf(Offset(0.5f, 0f), Offset(1f, 0.4f), Offset(0.5f, 1f), Offset(0f, 0.4f)),
perVertexRounding =
listOf(
CornerRounding(0.1f),
CornerRounding(0.15f),
CornerRounding(0.05f),
CornerRounding(0.15f),
),
)
)
}
Box(Modifier.size(width = 120.dp, height = 84.dp).clip(kite).background(Color(0xFF673AB7)))
}