-
-
Save KatieBarnett/5bf454b14e9b81f74785de2a407741a6 to your computer and use it in GitHub Desktop.
Zig zag translation
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
val zigZagPath = remember { | |
with(density) { | |
Path().apply { | |
val zigZagWidth = shapeWidth.toPx() | |
val zigZagHeight = shapeWidth.toPx() | |
val zigZagLineWidth = (1.dp).toPx() | |
val shapeVerticalOffset = (zigZagHeight / 2) / 2 | |
val shapeHorizontalOffset = (zigZagHeight / 2) / 2 | |
moveTo(0f, 0f) | |
lineTo(zigZagWidth / 2, zigZagHeight / 2) | |
lineTo(zigZagWidth, 0f) | |
lineTo(zigZagWidth, 0f + zigZagLineWidth) | |
lineTo(zigZagWidth / 2, zigZagHeight / 2 + zigZagLineWidth) | |
lineTo(0f, 0f + zigZagLineWidth) | |
translate(Offset(-shapeHorizontalOffset, -shapeVerticalOffset)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment