Skip to content

Instantly share code, notes, and snippets.

@chepsi
Created April 23, 2024 09:33
Show Gist options
  • Select an option

  • Save chepsi/2f83b85bbcab08bbc35feba158fd43b2 to your computer and use it in GitHub Desktop.

Select an option

Save chepsi/2f83b85bbcab08bbc35feba158fd43b2 to your computer and use it in GitHub Desktop.
Android254 Canvas Logo.
@Composable
fun InstagramLogo() {
Canvas(
modifier = Modifier
.size(200.dp)
.clip(RoundedCornerShape(10.dp))
) {
val width = size.width
val height = size.height
drawRoundRect(brush = InstaGradient)
drawRoundRect(
color = Color.White,
size = size.times(0.8f),
cornerRadius = CornerRadius(30f),
topLeft = Offset(
(center.x * 0.2f),
(center.y * 0.2f)
)
)
drawRoundRect(
brush = InstaGradient,
size = size.times(0.65f),
cornerRadius = CornerRadius(30f),
topLeft = Offset(
(center.x * 0.35f),
(center.y * 0.35f)
)
)
drawCircle(
color = Color.White,
radius = width.times(0.23f)
)
drawCircle(
brush = InstaGradient,
radius = width.times(0.15f)
)
drawCircle(
color = Color.White,
radius = 20f,
center = Offset((width * 0.73f), (height * 0.30f))
)
}
}
val InstaYellow = Color(0xFFFCD404)
val InstaPurple = Color(0xFF8444FC)
val InstaPink90 = Color(0xFFFE0B81)
val InstaGradient = Brush.linearGradient(
colors = listOf(
InstaYellow, InstaPink90, InstaPurple
), start = Offset(0f, Float.POSITIVE_INFINITY), end = Offset(Float.POSITIVE_INFINITY, 0f)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment