Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom path for the shape
fun drawArcPath(size: Size): Path {
return Path().apply {
reset()
// go from (0,0) to (width, 0)
lineTo(size.width, 0f)
// go from (width, 0) to (width, height)
lineTo(size.width, size.height)
// Draw an arch from (width, height) to (0, height)
// starting from 0 degree to 180 degree
arcTo(
rect =
Rect(
Offset(0f, 0f),
Size(size.width, size.height)
),
startAngleDegrees = 0f,
sweepAngleDegrees = 180f,
forceMoveTo = false
)
// go from (0, height) to (0, 0)
lineTo(0f, 0f)
close()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment