Skip to content

Instantly share code, notes, and snippets.

@AndreVero
Created February 24, 2024 13:37
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 AndreVero/3c7860a04eef5300162659a8e1201cae to your computer and use it in GitHub Desktop.
Save AndreVero/3c7860a04eef5300162659a8e1201cae to your computer and use it in GitHub Desktop.
Translate and scale function in Jetpack Compose
// Move our path to the new position
translate(
left = currentOffset.x - (pathBounds.right * iconScale) / 2,
top = currentOffset.y - 15.dp.toPx() - pathBounds.bottom
) {
// Increase path in 3 times
scale(scale = iconScale, pivot = pathBounds.topLeft) {
drawPath(
path = item.path,
color = Color.Black
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment