Created
April 24, 2024 13:50
-
-
Save alexaleluia12/969eb86c75bc4c8c670d44bc676a1ade to your computer and use it in GitHub Desktop.
dois triangulos lados opostos (shape compose) - todo: fz uma estrela
This file contains hidden or 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
class PentagoShape : Shape { | |
override fun createOutline( | |
size: Size, | |
layoutDirection: LayoutDirection, | |
density: Density | |
): Outline { | |
return Outline.Generic( | |
path = mycustonDraw(size = size) | |
) | |
} | |
// TODO(deixar estrela certinho) | |
fun mycustonDraw(size: Size): Path { | |
val path = Path() | |
path.moveTo(0f, 0f) | |
path.lineTo(size.width / 2f, size.height / 2f) | |
path.lineTo(size.width, 0f) | |
path | |
path.close() | |
val tp = Path().apply { | |
moveTo(0f, 0f) | |
lineTo(size.width / 2f, size.height / 2f) | |
lineTo(size.width, 0f) | |
close() | |
} | |
val bt = Path().apply { | |
moveTo(0f, size.height) | |
lineTo(size.width / 2f, size.height / 2f) | |
lineTo(size.width, size.height) | |
close() | |
} | |
tp.addPath(bt, Offset(0f, 0f)) | |
return tp | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment