Rajashekar
03/09/2021, 6:57 AMval points: List<Offset> = listOf(
Offset(200f, 200f), Offset(400f, 200f),
Offset(200f, 200f), Offset(200f, 400f),
Offset(400f, 200f), Offset(400f, 400f),
Offset(200f, 400f), Offset(400f, 400f),
Offset(200f, 400f), Offset(200f, 600f),
Offset(200f, 600f), Offset(400f, 600f),
Offset(400f, 400f), Offset(400f, 600f),
)
Two offsets completes a line, this whole points makes -> 8
How I want is, lines must be drawn between those points at certain duration.
Canvas(
modifier = Modifier.fillMaxSize()
) {
drawPoints(
points = points,
pointMode = PointMode.Lines,
color = Color.Gray,
strokeWidth = 16f,
cap = StrokeCap.Round,
pathEffect = PathEffect.dashPathEffect(floatArrayOf(8f, 16f))
)
}
Rajashekar
03/09/2021, 6:58 AMDoris Liu
03/09/2021, 7:02 AMHow I want is, lines must be drawn between those points at certain duration.Each individual line starts drawing simultaneously or sequentially?
Rajashekar
03/09/2021, 7:03 AMRajashekar
03/09/2021, 7:04 AMDoris Liu
03/09/2021, 7:18 AManimate
to animate between each pair of `Offset`s: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#animate_1
There's sample code for the Float variant of animate
(if you scroll up a little) that could help.Rajashekar
03/09/2021, 7:24 AMDoris Liu
03/09/2021, 7:42 AMoffset
Rajashekar
03/09/2021, 8:00 AM