Skip to content

Commit 864fd55

Browse files
authored
add path utils to snippets. (#211)
1 parent 2cc47d6 commit 864fd55

File tree

1 file changed

+4
-1
lines changed
  • compose/snippets/src/main/java/com/example/compose/snippets/graphics

1 file changed

+4
-1
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/graphics/ShapesSnippets.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ private fun MorphExampleAnimation() {
236236
// [END android_compose_graphics_polygon_morph_animation]
237237
}
238238

239+
// [START android_compose_morph_to_path]
239240
/**
240241
* Transforms the morph at a given progress into a [Path].
241242
* It can optionally be scaled, using the origin (0,0) as pivot point.
@@ -257,10 +258,11 @@ fun Morph.toComposePath(progress: Float, scale: Float = 1f, path: Path = Path())
257258
path.close()
258259
return path
259260
}
260-
261+
// [END android_compose_morph_to_path]
261262
/**
262263
* Function used to create a Path from a list of Cubics.
263264
*/
265+
// [START android_compose_list_cubics_to_path]
264266
fun List<Cubic>.toPath(path: Path = Path(), scale: Float = 1f): Path {
265267
path.rewind()
266268
firstOrNull()?.let { first ->
@@ -276,6 +278,7 @@ fun List<Cubic>.toPath(path: Path = Path(), scale: Float = 1f): Path {
276278
path.close()
277279
return path
278280
}
281+
// [END android_compose_list_cubics_to_path]
279282

280283
// [START android_compose_morph_clip_shape]
281284
class MorphPolygonShape(

0 commit comments

Comments
 (0)