Skip to content

Instantly share code, notes, and snippets.

@jaikeerthick
Created August 7, 2022 15:19
Show Gist options
  • Save jaikeerthick/68e1cf1a0e80ead0e56ee47b2cafae46 to your computer and use it in GitHub Desktop.
Save jaikeerthick/68e1cf1a0e80ead0e56ee47b2cafae46 to your computer and use it in GitHub Desktop.
Instagram Icon with Canvas API - Jetpack Compose
@Composable
fun Instagram() {
// gradient color for the icon
val gradientColor = listOf(Color.Yellow, Color.Red, Color.Magenta)
Canvas(
modifier = Modifier
.size(100.dp)
.padding(16.dp)
) {
drawRoundRect(
brush = Brush.linearGradient(
colors = gradientColor
),
cornerRadius = CornerRadius(
x = 60f,
y = 60f
),
style = Stroke(
width = 15f,
cap = StrokeCap.Round
)
)
drawCircle(
brush = Brush.linearGradient(
colors = gradientColor
),
radius = 45f,
style = Stroke(
width = 15f,
cap = StrokeCap.Round
)
)
drawCircle(
brush = Brush.linearGradient(
colors = gradientColor
),
radius = 12f,
center = Offset(
x= this.size.width * .8f, y = this.size.height * 0.22f
),
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment