Custom path for the shape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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