Capsule is a Jetpack Compose library that creates G2 continuous rounded rectangles.

Customizable curvature combs:

In build.gradle.kts, add
implementation("io.github.kyant0:capsule:<version>")
Replace the RoundedCornerShape with ContinuousRoundedRectangle or ContinuousCapsule:
// create a basic rounded corner shape
ContinuousRoundedRectangle(16.dp)
// create a capsule shape
ContinuousCapsule
Custom continuity:
val g1 = G1Continuity // no corner smoothness
val g2 = G2Continuity(
profile = G2ContinuityProfile.RoundedRectangle.copy(
extendedFraction = 0.5,
arcFraction = 0.5,
bezierCurvatureScale = 1.1,
arcCurvatureScale = 1.1
),
capsuleProfile = G2ContinuityProfile.Capsule.copy(
extendedFraction = 0.5,
arcFraction = 0.25
)
)
// create shapes with custom continuity
ContinuousRoundedRectangle(16.dp, continuity = g2)
ContinuousCapsule(continuity = g2)
The following parameters are supported by G2ContinuityProfile:
Note: It guarantees G1 continuity at least. Only if the Bezier curvature scale equals the arc curvature scale, it will have exact G2 continuity.
Drawing cubic Bézier curves on Android performs poorly. However, the Capsule library uses a very efficient method to calculate the control points, achieving optimal theoretical performance.
When the shape area is large (almost fullscreen) and the corner radius is constantly changing, performance may decrease.
Use animatedShape.copy(continuity = G1Continuity) to temporarily disable corner smoothing during the
animation.
2,546 followers · starred Aug 2025
245 followers · starred Aug 2025
72 followers · starred Nov 2025
Capsule is a Jetpack Compose library that creates G2 continuous rounded rectangles.

Customizable curvature combs:

In build.gradle.kts, add
implementation("io.github.kyant0:capsule:<version>")
Replace the RoundedCornerShape with ContinuousRoundedRectangle or ContinuousCapsule:
// create a basic rounded corner shape
ContinuousRoundedRectangle(16.dp)
// create a capsule shape
ContinuousCapsule
Custom continuity:
val g1 = G1Continuity // no corner smoothness
val g2 = G2Continuity(
profile = G2ContinuityProfile.RoundedRectangle.copy(
extendedFraction = 0.5,
arcFraction = 0.5,
bezierCurvatureScale = 1.1,
arcCurvatureScale = 1.1
),
capsuleProfile = G2ContinuityProfile.Capsule.copy(
extendedFraction = 0.5,
arcFraction = 0.25
)
)
// create shapes with custom continuity
ContinuousRoundedRectangle(16.dp, continuity = g2)
ContinuousCapsule(continuity = g2)
The following parameters are supported by G2ContinuityProfile:
Note: It guarantees G1 continuity at least. Only if the Bezier curvature scale equals the arc curvature scale, it will have exact G2 continuity.
Drawing cubic Bézier curves on Android performs poorly. However, the Capsule library uses a very efficient method to calculate the control points, achieving optimal theoretical performance.
When the shape area is large (almost fullscreen) and the corner radius is constantly changing, performance may decrease.
Use animatedShape.copy(continuity = G1Continuity) to temporarily disable corner smoothing during the
animation.
2,546 followers · starred Aug 2025
245 followers · starred Aug 2025
72 followers · starred Nov 2025