Created
August 7, 2022 15:19
-
-
Save jaikeerthick/68e1cf1a0e80ead0e56ee47b2cafae46 to your computer and use it in GitHub Desktop.
Instagram Icon with Canvas API - Jetpack Compose
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
@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