Skip to content

Instantly share code, notes, and snippets.

@aqua30
Created June 14, 2022 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aqua30/72fd748cdc654cb35a75c874c730fbe3 to your computer and use it in GitHub Desktop.
Save aqua30/72fd748cdc654cb35a75c874c730fbe3 to your computer and use it in GitHub Desktop.
fun rtlCurve(size: Size) = Path().apply {
reset()
val width = size.width
val height = size.height
val radius = 100f
val upShift = height * (1f - 0.5f)
// arc C1
arcTo(
rect = Rect(
left = 0f,
top = 0f,
right = radius * 2,
bottom = radius * 2
),
startAngleDegrees = 180f,
sweepAngleDegrees = 110f,
forceMoveTo = false
)
// arc C2
arcTo(
rect = Rect(
left = width - radius * 2,
top = upShift - 10,
right = width,
bottom = upShift + radius * 2
),
startAngleDegrees = -60f,
sweepAngleDegrees = 65f,
forceMoveTo = false
)
// arc C3
arcTo(
rect = Rect(
left = width - radius * 2,
top = height - radius * 2,
right = width,
bottom = height
),
startAngleDegrees = 0f,
sweepAngleDegrees = 90f,
forceMoveTo = false
)
// arc C4
arcTo(
rect = Rect(
left = 0f,
top = height - radius * 2,
right = radius * 2,
bottom = height
),
startAngleDegrees = 90f,
sweepAngleDegrees = 90f,
forceMoveTo = false
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment