Skip to content

Instantly share code, notes, and snippets.

@KatieBarnett
Last active March 17, 2024 06:04
Show Gist options
  • Save KatieBarnett/de6c56474b7d0e1ec8c7190cf99c4784 to your computer and use it in GitHub Desktop.
Save KatieBarnett/de6c56474b7d0e1ec8c7190cf99c4784 to your computer and use it in GitHub Desktop.
Zig Zag baseline
val zigZagPath = remember {
with(density) {
Path().apply {
val zigZagWidth = shapeWidth.toPx()
val zigZagHeight = shapeWidth.toPx()
val zigZagLineWidth = (1.dp).toPx()
moveTo(0f, 0f)
lineTo(zigZagWidth / 2, zigZagHeight)
lineTo(zigZagWidth, 0f)
lineTo(zigZagWidth, 0f + zigZagLineWidth)
lineTo(zigZagWidth / 2, zigZagHeight + zigZagLineWidth)
lineTo(0f, 0f + zigZagLineWidth)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment