Last active
January 28, 2021 07:32
-
-
Save akexorcist/cc971c56684a504434f2393220fbb92e to your computer and use it in GitHub Desktop.
Build Coupon UI - Right edge semi circle (https://medium.com/@akexorcist/how-we-built-developer-friendly-coupon-ui-in-android-part-2-78933730d335)
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
val canvas: Canvas = /* ... */ | |
val areaWidth = canvas.width | |
val areaHeight = canvas.height | |
val borderWidth = 2 | |
val cornerRadius = 10 | |
val semiCircleRadius = 20 | |
val path = Path().apply { | |
/* ... */ | |
// Right edge semi circle | |
arcTo( | |
left = (areaWidth / 2f) - ((semiCircleRadius / 2f) + (borderWidth / 2f)), | |
top = (areaHeight / 2f) - (semiCircleRadius / 2f), | |
right = (areaWidth / 2f) + ((semiCircleRadius / 2f) - (borderWidth / 2f)), | |
bottom = (areaHeight / 2f) + (semiCircleRadius / 2f), | |
startAngle = 270, | |
sweepAngle = -180, | |
forceMoveTo = false) | |
/* ... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment